вот часть моего CMakeLists.txt
find_package(Catch2)
if(TARGET Catch2::Catch2)
message("catch2 has been installed previously")
include(Catch)
else()
message("no target catch2")
include(FetchContent)
# Download and configure Catch2 for the tests
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG master
)
FetchContent_GetProperties(catch2)
if (NOT catch2_POPULATED)
FetchContent_Populate(catch2)
add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
include(Catch)
endif()
endif()
То, что я хочу сделать, - это если catch2 доступен, а затем использовать напрямую, иначе загружать с github автоматически. Теперь он отлично работает, кроме этого надоедливого предупреждения:
CMake Warning at test/CMakeLists.txt:9 (find_package):
By not providing "FindCatch2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Catch2", but
CMake did not find one.
Could not find a package configuration file provided by "Catch2" with any
of the following names:
Catch2Config.cmake
catch2-config.cmake
Add the installation prefix of "Catch2" to CMAKE_PREFIX_PATH or set
"Catch2_DIR" to a directory containing one of the above files. If "Catch2"
provides a separate development package or SDK, be sure it has been
installed.
Итак, как заставить замолчать это предупреждение?