Files
CPM.cmake/test/unit/modules.cmake
Lars Melchior 1ebbac6332 Apply clang-format and cmake-format and add style check workflow (#171)
* apply clang-format and cmake-format and add style check workflow

* add declare package definition

* add additional public methods and rename internals

* change development verison tag to 1.0.0

* rename internal method

* rename public method

* rename test var

* update copyright and fix comment

* typo

* run fix-format

* fix test function names
2021-01-06 14:40:33 +01:00

29 lines
954 B
CMake

include(CMakePackageConfigHelpers)
include(${CPM_PATH}/testing.cmake)
set(TEST_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/modules)
function(init_project_with_dependency TEST_DEPENDENCY_NAME)
configure_package_config_file(
"${CMAKE_CURRENT_LIST_DIR}/local_dependency/ModuleCMakeLists.txt.in"
"${CMAKE_CURRENT_LIST_DIR}/local_dependency/CMakeLists.txt"
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/junk
)
execute_process(
COMMAND ${CMAKE_COMMAND} "-H${CMAKE_CURRENT_LIST_DIR}/local_dependency" "-B${TEST_BUILD_DIR}"
RESULT_VARIABLE ret
)
assert_equal(${ret} "0")
endfunction()
init_project_with_dependency(A)
assert_exists(${TEST_BUILD_DIR}/CPM_modules)
assert_exists(${TEST_BUILD_DIR}/CPM_modules/FindA.cmake)
assert_not_exists(${TEST_BUILD_DIR}/CPM_modules/FindB.cmake)
init_project_with_dependency(B)
assert_not_exists(${TEST_BUILD_DIR}/CPM_modules/FindA.cmake)
assert_exists(${TEST_BUILD_DIR}/CPM_modules/FindB.cmake)