|
|
@@ -10,16 +10,19 @@ e.g. for debugging.
|
|
|
|
|
|
::
|
|
|
|
|
|
- cmake_print_properties([TARGETS target1 .. targetN]
|
|
|
- [SOURCES source1 .. sourceN]
|
|
|
- [DIRECTORIES dir1 .. dirN]
|
|
|
- [TESTS test1 .. testN]
|
|
|
- [CACHE_ENTRIES entry1 .. entryN]
|
|
|
- PROPERTIES prop1 .. propN )
|
|
|
+ cmake_print_properties(<TARGETS [<target1> ...] |
|
|
|
+ SOURCES [<source1> ...] |
|
|
|
+ DIRECTORIES [<dir1> ...] |
|
|
|
+ TESTS [<test1> ...] |
|
|
|
+ CACHE_ENTRIES [<entry1> ...] >
|
|
|
+ PROPERTIES [<prop1> ...] )
|
|
|
|
|
|
This function prints the values of the properties of the given targets,
|
|
|
source files, directories, tests or cache entries. Exactly one of the
|
|
|
-scope keywords must be used. Example::
|
|
|
+scope keywords must be used. The scope keyword and its arguments must
|
|
|
+come before the ``PROPERTIES`` keyword, in the arguments list.
|
|
|
+
|
|
|
+Example::
|
|
|
|
|
|
cmake_print_properties(TARGETS foo bar PROPERTIES
|
|
|
LOCATION INTERFACE_INCLUDE_DIRECTORIES)
|
|
|
@@ -56,17 +59,34 @@ endfunction()
|
|
|
function(cmake_print_properties)
|
|
|
set(options )
|
|
|
set(oneValueArgs )
|
|
|
- set(multiValueArgs TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES )
|
|
|
+ set(cpp_multiValueArgs PROPERTIES )
|
|
|
+ set(cppmode_multiValueArgs TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES )
|
|
|
+
|
|
|
+ string(JOIN " " _mode_names ${cppmode_multiValueArgs})
|
|
|
+ set(_missing_mode_message
|
|
|
+ "Mode keyword missing in cmake_print_properties() call, there must be exactly one of ${_mode_names}")
|
|
|
|
|
|
- cmake_parse_arguments(CPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
+ cmake_parse_arguments(
|
|
|
+ CPP "${options}" "${oneValueArgs}" "${cpp_multiValueArgs}" ${ARGN})
|
|
|
|
|
|
- if(CPP_UNPARSED_ARGUMENTS)
|
|
|
- message(FATAL_ERROR "Unknown keywords given to cmake_print_properties(): \"${CPP_UNPARSED_ARGUMENTS}\"")
|
|
|
+ if(NOT CPP_PROPERTIES)
|
|
|
+ message(FATAL_ERROR
|
|
|
+ "Required argument PROPERTIES missing in cmake_print_properties() call")
|
|
|
return()
|
|
|
endif()
|
|
|
|
|
|
- if(NOT CPP_PROPERTIES)
|
|
|
- message(FATAL_ERROR "Required argument PROPERTIES missing in cmake_print_properties() call")
|
|
|
+ if(NOT CPP_UNPARSED_ARGUMENTS)
|
|
|
+ message(FATAL_ERROR "${_missing_mode_message}")
|
|
|
+ return()
|
|
|
+ endif()
|
|
|
+
|
|
|
+ cmake_parse_arguments(
|
|
|
+ CPPMODE "${options}" "${oneValueArgs}" "${cppmode_multiValueArgs}"
|
|
|
+ ${CPP_UNPARSED_ARGUMENTS})
|
|
|
+
|
|
|
+ if(CPPMODE_UNPARSED_ARGUMENTS)
|
|
|
+ message(FATAL_ERROR
|
|
|
+ "Unknown keywords given to cmake_print_properties(): \"${CPPMODE_UNPARSED_ARGUMENTS}\"")
|
|
|
return()
|
|
|
endif()
|
|
|
|
|
|
@@ -74,32 +94,32 @@ function(cmake_print_properties)
|
|
|
set(items)
|
|
|
set(keyword)
|
|
|
|
|
|
- if(CPP_TARGETS)
|
|
|
- set(items ${CPP_TARGETS})
|
|
|
+ if(CPPMODE_TARGETS)
|
|
|
+ set(items ${CPPMODE_TARGETS})
|
|
|
set(mode ${mode} TARGETS)
|
|
|
set(keyword TARGET)
|
|
|
endif()
|
|
|
|
|
|
- if(CPP_SOURCES)
|
|
|
- set(items ${CPP_SOURCES})
|
|
|
+ if(CPPMODE_SOURCES)
|
|
|
+ set(items ${CPPMODE_SOURCES})
|
|
|
set(mode ${mode} SOURCES)
|
|
|
set(keyword SOURCE)
|
|
|
endif()
|
|
|
|
|
|
- if(CPP_TESTS)
|
|
|
- set(items ${CPP_TESTS})
|
|
|
+ if(CPPMODE_TESTS)
|
|
|
+ set(items ${CPPMODE_TESTS})
|
|
|
set(mode ${mode} TESTS)
|
|
|
set(keyword TEST)
|
|
|
endif()
|
|
|
|
|
|
- if(CPP_DIRECTORIES)
|
|
|
- set(items ${CPP_DIRECTORIES})
|
|
|
+ if(CPPMODE_DIRECTORIES)
|
|
|
+ set(items ${CPPMODE_DIRECTORIES})
|
|
|
set(mode ${mode} DIRECTORIES)
|
|
|
set(keyword DIRECTORY)
|
|
|
endif()
|
|
|
|
|
|
- if(CPP_CACHE_ENTRIES)
|
|
|
- set(items ${CPP_CACHE_ENTRIES})
|
|
|
+ if(CPPMODE_CACHE_ENTRIES)
|
|
|
+ set(items ${CPPMODE_CACHE_ENTRIES})
|
|
|
set(mode ${mode} CACHE_ENTRIES)
|
|
|
# This is a workaround for the fact that passing `CACHE` as an argument to
|
|
|
# set() causes a cache variable to be set.
|
|
|
@@ -108,13 +128,14 @@ function(cmake_print_properties)
|
|
|
endif()
|
|
|
|
|
|
if(NOT mode)
|
|
|
- message(FATAL_ERROR "Mode keyword missing in cmake_print_properties() call, must be one of TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES")
|
|
|
+ message(FATAL_ERROR "${_missing_mode_message}")
|
|
|
return()
|
|
|
endif()
|
|
|
|
|
|
list(LENGTH mode modeLength)
|
|
|
if("${modeLength}" GREATER 1)
|
|
|
- message(FATAL_ERROR "Multiple mode keyword used in cmake_print_properties() call, it must be exactly one of TARGETS SOURCES TESTS DIRECTORIES CACHE_ENTRIES PROPERTIES")
|
|
|
+ message(FATAL_ERROR
|
|
|
+ "Multiple mode keywords used in cmake_print_properties() call, there must be exactly one of ${_mode_names}.")
|
|
|
return()
|
|
|
endif()
|
|
|
|
|
|
@@ -124,8 +145,8 @@ function(cmake_print_properties)
|
|
|
set(itemExists TRUE)
|
|
|
if(keyword STREQUAL "TARGET")
|
|
|
if(NOT TARGET ${item})
|
|
|
- set(itemExists FALSE)
|
|
|
- string(APPEND msg "\n No such TARGET \"${item}\" !\n\n")
|
|
|
+ set(itemExists FALSE)
|
|
|
+ string(APPEND msg "\n No such TARGET \"${item}\" !\n\n")
|
|
|
endif()
|
|
|
endif()
|
|
|
|