mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 22:58:14 -05:00
* Fix #222 * Fix #222 * move policy change and local options to cpm_add_subdirectory * change default policy as well see https://gitlab.kitware.com/cmake/cmake/-/issues/20312 * add test * update check to not use the NOT operator (interestingly it works as expected locally) * simplify test by not using options * check options in tests Co-authored-by: Lars Melchior <TheLartians@users.noreply.github.com>
34 lines
722 B
Plaintext
34 lines
722 B
Plaintext
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
|
|
project(CPMTest)
|
|
|
|
# ---- 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
|
|
OPTIONS "DEFINE_ALTERNATIVE_FUNCTION YES"
|
|
EXCLUDE_FROM_ALL YES
|
|
)
|
|
|
|
# ---- Dependencies ----
|
|
|
|
alternative_dependency_function()
|
|
|
|
# ---- Check parameters ----
|
|
|
|
include(@CPM_PATH@/testing.cmake)
|
|
|
|
message("DEFINE_ALTERNATIVE_FUNCTION: ${DEFINE_ALTERNATIVE_FUNCTION}")
|
|
|
|
# this option is overridden by CPM.cmake
|
|
ASSERT_NOT_DEFINED(DEFINE_ALTERNATIVE_FUNCTION)
|
|
# this option is leaked by the dependency
|
|
ASSERT_EQUAL(${LEAKED_OPTION} "OFF")
|