Performance improvement: bypass FetchContent for cached dependencies (#182)

* skip FetchContent for cached dependencies

* set default value for CPM_SKIP_FETCH to avoid conflicts

* add tests to check exported values
This commit is contained in:
Lars Melchior
2021-01-20 13:15:18 +01:00
committed by GitHub
parent aad0397beb
commit ab6e8d6d8c
5 changed files with 68 additions and 12 deletions

View File

@@ -24,3 +24,11 @@ endif()
# ---- Call dependency method to validate correct addition of directory ----
dependency_function()
# ---- Check parameters ----
include(@CPM_PATH@/testing.cmake)
ASSERT_TRUTHY(@TEST_DEPENDENCY_NAME@_ADDED)
ASSERT_DEFINED(@TEST_DEPENDENCY_NAME@_SOURCE_DIR)
ASSERT_DEFINED(@TEST_DEPENDENCY_NAME@_BINARY_DIR)

View File

@@ -17,3 +17,11 @@ CPMAddPackage(
# ---- Call dependency method to validate correct addition of directory ----
dependency_function()
# ---- Check parameters ----
include(@CPM_PATH@/testing.cmake)
ASSERT_TRUTHY(Dependency_ADDED)
ASSERT_DEFINED(Dependency_SOURCE_DIR)
ASSERT_DEFINED(Dependency_BINARY_DIR)

View File

@@ -22,3 +22,11 @@ CPMAddPackage(
add_executable(CPMExampleCatch2 main.cpp)
target_link_libraries(CPMExampleCatch2 fibonacci)
set_target_properties(CPMExampleCatch2 PROPERTIES CXX_STANDARD 17 COMPILE_FLAGS "-Wall -pedantic -Wextra -Werror")
# ---- Check parameters ----
include(@CPM_PATH@/testing.cmake)
ASSERT_TRUTHY(fibonacci_ADDED)
ASSERT_DEFINED(fibonacci_SOURCE_DIR)
ASSERT_DEFINED(fibonacci_BINARY_DIR)