simongog / sdsl-lite

Succinct Data Structure Library 2.0
Other
2.2k stars 349 forks source link

libdivsufsort breaks GNUInstallDirs #427

Open Flamefire opened 4 years ago

Flamefire commented 4 years ago

Look at https://github.com/simongog/libdivsufsort/blob/22e6b23e619ff50fd086844b6e618d53ca9d53bd/CMakeLists.txt#L30-L48 This sets cache variables to empty, then (if empty) sets local variables to a default but leaving the cache variables empty.

Those local variables will only be used in that folder and its subfolders but the cache variables propagate into the whole project. Those then get used by other dependencies

As 2.1.1 is the latest release and the referenced googletest commit does not exist using any other googletest version results in a build failure, either of:

 CMake Error at external/googletest/googletest/cmake/internal_utils.cmake:332 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "gtest".

at configure time, or similar at install time:

CMake Error at external/googletest/googlemock/cmake_install.cmake:41 (file):
  file INSTALL given no DESTINATION

This is due them using the proper https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html ending up with empty paths

Solution:

Related: GMock should not be build and GTest should not be installed. So

set(BUILD_GMOCK OFF)
set(INSTALL_GTEST OFF)

should be set before including the subdirectory and I recommend including the root folder of googletest and googletest/googletest as done in master.

pjotrp commented 4 years ago

Note that Debian patches sdsl-lite to do exactly that.