Allow passing lists in the options (#302)

* allow list options by passing option parameter as string, not value

* add test

* remove debug message

* run formatter
This commit is contained in:
Lars Melchior
2021-12-05 16:07:20 +01:00
committed by GitHub
parent 6491382204
commit 718ea71759
3 changed files with 15 additions and 7 deletions

View File

@@ -13,7 +13,9 @@ include(@CPM_PATH@/CPM.cmake)
CPMAddPackage(
NAME Dependency
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/dependency
OPTIONS "DEFINE_ALTERNATIVE_FUNCTION YES"
OPTIONS
"DEFINE_ALTERNATIVE_FUNCTION YES"
"LIST_ARGUMENT a\\\\;b\\\\;c"
EXCLUDE_FROM_ALL YES
)

View File

@@ -8,6 +8,12 @@ if(NOT DEFINE_ALTERNATIVE_FUNCTION)
message("called external method")
endfunction()
else()
# check if list was passed correctly
if(NOT "${LIST_ARGUMENT}" STREQUAL "a;b;c")
message(FATAL_ERROR "list argument not properly passed to dependency: '${LIST_ARGUMENT}'")
endif()
function(alternative_dependency_function)
message("called alternative external method")
endfunction()