InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
Tests fail to configure: Target "ITKCommonGTestDriver" links to GTest::GTest but the target was not found
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
```
-- Configuring done
CMake Error at CMake/ITKModuleTest.cmake:197 (target_link_libraries):
Target "ITKCommonGTestDriver" links to:
GTest::GTest
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
Modules/Core/Common/test/CMakeLists.txt:658 (CreateGoogleTestDriver)
CMake Error at CMake/ITKModuleTest.cmake:197 (target_link_libraries):
Target "ITKConnectedComponentsGTestDriver" links to:
GTest::GTest
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
Modules/Segmentation/ConnectedComponents/test/CMakeLists.txt:88 (CreateGoogleTestDriver)
```
This patch helps, but I don't understand why:
```
--- CMake/ITKModuleTest.cmake.orig 2022-11-17 05:24:11 UTC
+++ CMake/ITKModuleTest.cmake
@@ -193,6 +193,7 @@ endfunction()
function(CreateGoogleTestDriver KIT KIT_LIBS KitTests)
set(exe "${KIT}GTestDriver")
+ find_package(GTest)
add_executable(${exe} ${KitTests})
target_link_libraries(${exe} ${KIT_LIBS} GTest::GTest GTest::Main)
itk_module_target_label(${exe})
```
Version: 5.3rc04
FreeBSD 13.1
Contributor guide
Assessment
This issue has not been assessed yet.