Commit cc413ce9 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-11753 Link failure on missing -L${LIBLZ4_LIBRARY_DIR}

On FreeBSD liblz4 is installed in /usr/local/lib.
Groonga uses pkg_check_modules to check for liblz4 (that is, pkg-config),
and then it used to set for libgroonga.a

  link_directories({$LIBLZ4_LIBRARY_DIRS})
  target_link_libraries(... ${LIBLZ4_LIBRARIES})

Now groonga is a static library, linked into ha_mroonga.so. CMake won't
link dynamic liblz4.so into libgroonga.a, instead it'll pass it as a
dependency and will link it into ha_mroonga.so. Fine so far. But it will
not pass link_directories from the static library as a dependency,
so ha_mroonga.so won't find liblz4.so

As suggested on cmake mailing list (e.g.
here: http://public.kitware.com/pipermail/cmake/2011-November/047468.html)
we switch to use the full path to liblz4.so, instead of the -l/-L pair.
parent 370cf701
......@@ -22,8 +22,14 @@ include_directories(
${ONIGMO_INCLUDE_DIRS}
${MRUBY_INCLUDE_DIRS}
${LIBLZ4_INCLUDE_DIRS})
link_directories(
${LIBLZ4_LIBRARY_DIRS})
if (LIBLZ4_LIBRARY_DIRS)
find_library(LZ4_LIBS
NAMES ${LIBLZ4_LIBRARIES}
PATHS ${LIBLZ4_LIBRARY_DIRS}
NO_DEFAULT_PATH)
else()
set(LZ4_LIBS ${LIBLZ4_LIBRARIES})
endif()
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
......@@ -60,7 +66,7 @@ set(GRN_ALL_LIBRARIES
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBRARIES}
${LZ4_LIBS}
${DL_LIBS}
${M_LIBS}
${WS2_32_LIBS}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment