Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix finding readline in cmake #75

Merged
merged 12 commits into from
Nov 12, 2018
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ if(CMAKE_THREAD_LIBS_INIT)
set(THREAD_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${THREAD_LIBRARIES})
endif(CMAKE_THREAD_LIBS_INIT)


find_package(PkgConfig)
if(PKGCONFIG_FOUND)
set(HAVE_PKG_CONFIG 1)
Expand All @@ -60,11 +59,10 @@ if(USE_SSM)
find_package(SSM)
endif(USE_SSM)

set(READLINE_LIBRARIES "")
find_library(READLINE_LIBRARIES readline)
if(READLINE_LIBRARIES )
find_package(Readline)
if(READLINE_FOUND)
add_definitions(-DHAVE_LIBREADLINE=1)
endif(READLINE_LIBRARIES )
endif(READLINE_FOUND)

include(CheckFunctionExists)
check_function_exists(longjmp HAVE_LONGJMP)
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ COPY ./ /yp-spur
RUN mkdir -p /yp-spur/build
WORKDIR /yp-spur/build
RUN cmake .. && make -j && make test && make install
# check that ypspur-interpreter is built without readline
RUN ldd ypspur-interpreter | grep libreadline.so; test $? -eq 1

RUN apt-get install -y --no-install-recommends libreadline-dev

RUN mkdir -p /yp-spur/build-readline
WORKDIR /yp-spur/build-readline
RUN cmake .. && make -j && make test && make install
at-wat marked this conversation as resolved.
Show resolved Hide resolved
# check that ypspur-interpreter is built with readline
RUN ldd ypspur-interpreter | grep libreadline.so
19 changes: 19 additions & 0 deletions cmake/modules/FindReadline.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Find readline library

find_path(READLINE_INCLUDE_DIRS readline/readline.h
HINTS ENV READLINE_DIR
PATH_SUFFIXES include
)
find_library(READLINE_LIBRARIES_FOUND
NAMES readline
HINTS ENV READLINE_DIR
)
if(READLINE_LIBRARIES_FOUND)
set(READLINE_LIBRARIES readline)
endif(READLINE_LIBRARIES_FOUND)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(READLINE
DEFAULT_MSG READLINE_LIBRARIES
READLINE_INCLUDE_DIRS
)
1 change: 0 additions & 1 deletion cmake/modules/FindSSM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ find_package_handle_standard_args(SSM
SSM_INCLUDE_DIRS
SSM_EXECUTABLE
)

1 change: 0 additions & 1 deletion cmake/modules/GetGitRevision.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ function(get_git_revision)
set(GIT_REVISION ${REVISION} PARENT_SCOPE)

endfunction(get_git_revision)

4 changes: 4 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
<license>MIT</license>

<buildtool_depend>cmake</buildtool_depend>

<build_depend>libreadline-dev</build_depend>

<exec_depend>catkin</exec_depend>
<exec_depend>libreadline</exec_depend>

<export>
<build_type>cmake</build_type>
Expand Down