Gtest with ITK_USE_SYSTEM_LIBRARIES

Hi, just compiling ITK in new laptop and hitting the following, I have no gtest installed in the computer, but I do want to use other system libraries (fftw mainly)

cmake -G Ninja ../ITK-src \
-DExternalData_OBJECT_STORES:PATH=~/Software/ITK/ExternalData \
-DITK_USE_SYSTEM_LIBRARIES:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=~/devtoolset/release/ITK \
-DITK_USE_FFTW:BOOL=ON -DITK_USE_FFTWD:BOOL=ON -DITK_USE_FFTWS:BOOL=ON -DITK_USE_FFTWF:BOOL=ON \
-DModule_IsotropicWavelets:BOOL=ON \
-DModule_ITKVtkGlue:BOOL=ON
CMake Error at /usr/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
  GTEST_MAIN_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.11/Modules/FindGTest.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  Modules/ThirdParty/GoogleTest/itk-module-init.cmake:36 (find_package)
  CMake/ITKModuleEnablement.cmake:318 (include)
  CMakeLists.txt:400 (include)

Shoudn’t cmake handle the case where gtest is not the in the system and download it?

Nevermind, seems the default behaviour. If I install gtest in the system, I get same error with HDF5.

I guess ITK_USE_SYSTEM_LIBRARIES requires all the libraries to be installed in the system.

1 Like

That’s right. But you can specify individually which libraries are provided by the system. ITK_USE_SYSTEM_LIBRARIES is just a shortcut to set all the libraries with system variants to SYSTEM.

1 Like