Support CPM_SOURCE_CACHE on windows (#109)

* use semicolon as empty command and add test

* remove platform specific test coverage

* only run actions for pushes and prs into master (avoid duplication)

* remove cache test as it's already part of the test suite

* update version

* test cache reuse
This commit is contained in:
Lars Melchior
2020-04-25 00:51:18 +02:00
committed by GitHub
parent 464ba554c2
commit 618cdefa0d
9 changed files with 40 additions and 48 deletions

View File

@@ -8,6 +8,7 @@ set(CPM_SOURCE_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/CPM")
set(TEST_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/cache)
function(clear_cache)
message(STATUS "clearing CPM cache")
FILE(REMOVE_RECURSE ${CPM_SOURCE_CACHE_DIR})
if (EXISTS "${CPM_SOURCE_CACHE_DIR}")
@@ -104,6 +105,16 @@ if (NOT EXISTS "${CPM_SOURCE_CACHE_DIR}/fibonacci")
ASSERTION_FAILED("fibonacci not in cache")
endif()
## Reuse cached packages for other build
execute_process(
COMMAND
${CMAKE_COMMAND} -E env "CPM_SOURCE_CACHE=${CPM_SOURCE_CACHE_DIR}" ${CMAKE_COMMAND} "-H${CMAKE_CURRENT_LIST_DIR}/cache" "-B${TEST_BUILD_DIR}-2"
RESULT_VARIABLE ret
)
ASSERT_EQUAL(${ret} "0")
## Overwrite CPM_SOURCE_CACHE with argument
reset_test()