summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-05-08 22:39:14 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-05-08 22:49:29 +0300
commitb62224e232fedf982598aa4b373962c4c3746400 (patch)
tree2e08e85a147cbc46adf5028045c1175526dfb0ad /storage
parent1bc3899a52fd32a9d62f0c43eb9da8738204e4a7 (diff)
downloadmariadb-git-b62224e232fedf982598aa4b373962c4c3746400.tar.gz
Mroonga cmake failure - LZ4_LIBS = NOTFOUND
The following variables are used in this project, but they are set to NOTFOUND. LZ4_LIBS The reason for the failure is that pkg_check_modules will not guarantee <prefix>_LIBRARY_DIRS variable to be set, according to documentation. When it's not set, we would force find_library to look in an empty path and thus fail to correctly find LZ4_LIBS, although pck_check_modules did previously discover that the library is installed. To fix the problem and still keep the logic of first following LIBLZ4_LIBRARY_DIRS and *then* look at other paths, we call find_library twice. This is the recommended approach, according to CMake 3.11 documentation.
Diffstat (limited to 'storage')
-rw-r--r--storage/mroonga/vendor/groonga/CMakeLists.txt14
1 files changed, 11 insertions, 3 deletions
diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt
index e27070f9e0c..ee526646c09 100644
--- a/storage/mroonga/vendor/groonga/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/CMakeLists.txt
@@ -361,10 +361,18 @@ if(NOT ${GRN_WITH_LZ4} STREQUAL "no")
pkg_check_modules(LIBLZ4 liblz4)
endif()
if(LIBLZ4_FOUND)
+ # According to CMake documentation, this is the recommended way to force
+ # looking in LIBRARY_DIRS first and in regular system paths otherwise.
+ #
+ # pkg_check_modules does not guarantee that LIBLZ4_LIBRARY_DIRS will be
+ # set. If it's not set we won't find the library without looking through
+ # the regular system paths.
find_library(LZ4_LIBS
- NAMES ${LIBLZ4_LIBRARIES}
- PATHS ${LIBLZ4_LIBRARY_DIRS}
- NO_DEFAULT_PATH)
+ NAMES ${LIBLZ4_LIBRARIES}
+ PATHS ${LIBLZ4_LIBRARY_DIRS}
+ NO_DEFAULT_PATH)
+ find_library(LZ4_LIBS
+ NAMES ${LIBLZ4_LIBRARIES})
set(GRN_WITH_LZ4 TRUE)
else()
if(${GRN_WITH_LZ4} STREQUAL "yes")