-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for SOURCE_DIR argument (#97)
* add support for SOURCE_DIR argument * simplify code * add test * update comment
- Loading branch information
1 parent
775a235
commit 01b69aa
Showing
5 changed files
with
61 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
include(CMakePackageConfigHelpers) | ||
include(${CPM_PATH}/testing.cmake) | ||
|
||
set(TEST_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/source_dir) | ||
|
||
configure_package_config_file( | ||
"${CMAKE_CURRENT_LIST_DIR}/source_dir/CMakeLists.txt.in" | ||
"${CMAKE_CURRENT_LIST_DIR}/source_dir/CMakeLists.txt" | ||
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/junk | ||
) | ||
|
||
execute_process( | ||
COMMAND | ||
${CMAKE_COMMAND} "-H${CMAKE_CURRENT_LIST_DIR}/source_dir" "-B${TEST_BUILD_DIR}" | ||
RESULT_VARIABLE ret | ||
) | ||
|
||
ASSERT_EQUAL(${ret} "0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/CMakeLists.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 Dependency | ||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/dependency | ||
) | ||
|
||
# ---- Call dependency method to validate correct addition of directory ---- | ||
|
||
dependency_function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
function(dependency_function) | ||
message("called external method") | ||
endfunction() |