SyneRBI / SIRF-SuperBuild

SIRF CMake SuperBuild
http://www.ccpsynerbi.ac.uk
Apache License 2.0
15 stars 17 forks source link

building Gadgetron with testing requires CMake 3.23 (missing target GTest::gmock) #823

Closed KrisThielemans closed 5 months ago

KrisThielemans commented 11 months ago

With CMake 3.17 we get

GTEST FOUND: TRUE
...
-- Configuring done
CMake Error at test/CMakeLists.txt:62 (add_executable):
  Target "test_all" links to target "GTest::gmock" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

https://cmake.org/cmake/help/latest/module/FindGTest.html states that GTest::gmock is introduced in CMake 3.23.

We should therefore check CMake version and set BUILD_TESTING_Gadgetron=OFF and add a warning if CMake is too old to enhance our user experience.

KrisThielemans commented 5 months ago

best to use message(FATAL_ERROR ...) as opposed to a warning.

paskino commented 5 months ago

The message should be added here https://github.com/SyneRBI/SIRF-SuperBuild/blob/929fa6052d14d2c5f99d8917f5cd0b27c13bece8/SuperBuild/External_Gadgetron.cmake#L139