diff --git a/CMakeLists.txt b/CMakeLists.txt index a03a4c9a..97414a3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ list(APPEND force-libcxx "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME") list(APPEND build-docs "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME") list(APPEND build-docs "NOT CMAKE_VERSION VERSION_LESS 3.11") list(APPEND build-docs "Doxygen_FOUND") -list(APPEND build-docs "EXISTS docs") +list(APPEND build-docs "EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/docs") option(CLI11_WARNINGS_AS_ERRORS "Turn all warnings into errors (for CI)") option(CLI11_SINGLE_FILE "Generate a single header file") @@ -64,7 +64,7 @@ cmake_dependent_option(CLI11_BUILD_TESTS cmake_dependent_option(CLI11_BUILD_EXAMPLES "Build CLI11 examples" ON - "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME;EXISTS examples" OFF) + "CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME;EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/examples" OFF) cmake_dependent_option(CLI11_BUILD_EXAMPLES_JSON "Build CLI11 json example" OFF @@ -267,7 +267,7 @@ if(CLI11_BUILD_DOCS) endif() # From a build system, this might not be included. -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND EXISTS book) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/book") add_subdirectory(book) endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 0096607a..2359d5cd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,10 +12,12 @@ function(add_cli_exe T) endfunction() if(CLI11_BUILD_EXAMPLES_JSON) + message(STATUS "Using nlohmann/json") FetchContent_Declare(json - GIT_REPOSITORY https://github.com/nlohmann/json.git - GIT_SHALLOW 1 - GIT_TAG v3.7.3) + URL https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip + URL_HASH "SHA256=87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014" + ) + FetchContent_GetProperties(json) if (NOT json_POPULATED) FetchContent_Populate(json) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 21d5c00a..f697867d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,7 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CLI11_SOURCE_DIR}/cmake") if(CLI11_SANITIZERS) + message(STATUS "Using arsenm/sanitizers-cmake") FetchContent_Declare(sanitizers GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake.git GIT_SHALLOW 1