mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 22:58:14 -05:00
create FindXXX.cmake modules for added CPM packages (#112)
* create FindXXX.cmake modules for added CPM packages * don't use list(PREPEND) as it unsupported on older CMake versions * use CMAKE_BINARY_DIR * ensure CPM.cmake is initialized only once * import CPM.cmake in modules
This commit is contained in:
1
test/unit/test_project/.gitignore
vendored
Normal file
1
test/unit/test_project/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/CMakeLists.txt
|
||||
26
test/unit/test_project/CMakeLists.txt.in
Normal file
26
test/unit/test_project/CMakeLists.txt.in
Normal file
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
|
||||
project(CPMExampleCatch2)
|
||||
|
||||
# ---- Options ----
|
||||
|
||||
option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF)
|
||||
|
||||
# ---- Dependencies ----
|
||||
|
||||
include(@CPM_PATH@/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME @TEST_DEPENDENCY_NAME@
|
||||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/dependency
|
||||
)
|
||||
|
||||
# ---- check if generated modules override find_package ----
|
||||
|
||||
if (@test_check_find_package@)
|
||||
find_package(@TEST_DEPENDENCY_NAME@ REQUIRED)
|
||||
endif()
|
||||
|
||||
# ---- Call dependency method to validate correct addition of directory ----
|
||||
|
||||
dependency_function()
|
||||
4
test/unit/test_project/dependency/CMakeLists.txt
Normal file
4
test/unit/test_project/dependency/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
function(dependency_function)
|
||||
message("called external method")
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user