Google Test Issues

I am having a good deal of trouble building ITK from development sources on Fedora 34. The problem occurs during Google Test detection. Here are the beginning of the errors:

CMake Error at CMake/ITKModuleTest.cmake:254 (include):
include could not find requested file:

GoogleTest

Call Stack (most recent call first):
Modules/Core/ImageAdaptors/test/CMakeLists.txt:31 (CreateGoogleTestDriver)

CMake Error at CMake/ITKModuleTest.cmake:254 (include):
include could not find requested file:

GoogleTest

Call Stack (most recent call first):
Modules/Filtering/ImageFilterBase/test/CMakeLists.txt:42 (CreateGoogleTestDriver)

CMake Error at CMake/ITKModuleTest.cmake:254 (include):
include could not find requested file:

CMake does pick up the correct directory, in this case /usr/lib64/cmake/GTest, but for some reason inexplicably fails.

Do you know what I can do to make some more progress?

Did you try turning ITK_USE_SYSTEM_GOOGLETEST off? The version from OS might not play well with ITK, whereas the bundled version should.

Yes, it was off which is the default I think. I turned it on and the configure still failed.

Which version of ITK are you using?

I’m building from development sources.

@blowekamp you removed GoogleTest.cmake in 6a6482a. What does include(GoogleTest) includes now?

The standard CMake modules should be used now for FindGTest, and GoogleTest.

The above seem to be the source of the problem. The CMake GoogleTest module is not available, it should be part of the CMake installation.

What version of CMake are you using?

Do you mean you are building from git master? or another version?

I’m using CMake 3.20.5 and am building from git master. I can try to reinstall CMake or try a later version.

The GoogleTest.cmake file should be installed in some place like: /usr/share/cmake-3.20/Modules/GoogleTest.cmake

OK, GoogleTest.cmake is missing. The Fedora package gtest-devel provides these files:
/usr/lib64/cmake/GTest/GTestConfig.cmake
/usr/lib64/cmake/GTest/GTestConfigVersion.cmake
/usr/lib64/cmake/GTest/GTestTargets-noconfig.cmake
/usr/lib64/cmake/GTest/GTestTargets.cmake

I have reinstalled CMake 3.20.5 and still do not have GoogleTest.cmake.

It should be part of CMake.

On my computer, it is in C:\Program Files\CMake\share\cmake-3.21\Modules\GoogleTest.cmake.

OK, thank you for your help. I reinstalled Fedora’s cmake-data package which restored GoogleTest.cmake to /usr/share/cmake/Modules.

2 Likes