Closed theShmoo closed 2 years ago
Fixed the issue by adding EXCLUDE_FROM_ALL
in my fetch:
message(STATUS "Fetch range")
FetchContent_Declare(
range-v3
URL https://github.com/ericniebler/range-v3/archive/refs/tags/0.11.0.tar.gz
)
FetchContent_GetProperties(range-v3)
if (NOT range-v3_POPULATED)
FetchContent_Populate(range-v3)
add_subdirectory(${range-v3_SOURCE_DIR} ${range-v3_BINARY_DIR} EXCLUDE_FROM_ALL)
target_include_directories(range-v3 SYSTEM INTERFACE $<BUILD_INTERFACE:${range-v3_SOURCE_DIR}/include>)
endif ()
Note: CMake v3.25 has a new SYSTEM target property and accompanying arguments to FetchContent and add_subdirectory
.
I am using CMake Fetch to include the ranges library into my project. As it is header only I don't need to install it. But it is installed automatically as
install
is called in the root CMakeLists.txtThanks!