In my C++ projects, I'm used to including libraries like googletest and catch2 using FetchContent functionality in CMake:
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.10.2
)
FetchContent_MakeAvailable(catch2)
target_link_libraries(mytests PRIVATE myapp Catch2::Catch2)
I haven't been able to get a similar setup working with check. If I do something like this:
FetchContent_Declare(
check
GIT_REPOSITORY https://github.com/libcheck/check.git
GIT_TAG 0.13.0
)
FetchContent_MakeAvailable(check)
target_link_libraries(mytests PRIVATE myapp Check::check)
I get this error:
CMake Error at tests/CMakeLists.txt:10 (add_executable):
Target "loxtest" links to target "Check::check" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
What am I doing wrong?
In my C++ projects, I'm used to including libraries like
googletestandcatch2usingFetchContentfunctionality in CMake:I haven't been able to get a similar setup working with
check. If I do something like this:I get this error:
What am I doing wrong?