summaryrefslogtreecommitdiff
path: root/Modules/CMakePrintHelpers.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CMakePrintHelpers.cmake')
-rw-r--r--Modules/CMakePrintHelpers.cmake73
1 files changed, 36 insertions, 37 deletions
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index ef5d857b6..21c333e31 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -1,52 +1,51 @@
-# - Convenience macros for printing properties and variables, useful e.g. for debugging.
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#.rst:
+# CMakePrintHelpers
+# -----------------
+#
+# Convenience macros for printing properties and variables, useful 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 .. targetN]
+# [SOURCES source1 .. sourceN]
+# [DIRECTORIES dir1 .. dirN]
+# [TESTS test1 .. testN]
+# [CACHE_ENTRIES entry1 .. entryN]
+# PROPERTIES prop1 .. propN )
#
# This macro 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:
-# cmake_print_properties(TARGETS foo bar PROPERTIES LOCATION INTERFACE_INCLUDE_DIRS)
-# This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for both
-# targets foo and bar.
+# source files, directories, tests or cache entries. Exactly one of the
+# scope keywords must be used. Example::
+#
+# cmake_print_properties(TARGETS foo bar PROPERTIES
+# LOCATION INTERFACE_INCLUDE_DIRS)
+#
+# This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for
+# both targets foo and bar.
#
#
-# CMAKE_PRINT_VARIABLES(var1 var2 .. varN)
+#
+# CMAKE_PRINT_VARIABLES(var1 var2 .. varN)
#
# This macro will print the name of each variable followed by its value.
-# Example:
-# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION THIS_ONE_DOES_NOT_EXIST)
-# Gives:
-# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST=""
-
-#=============================================================================
-# Copyright 2013 Alexander Neundorf, <neundorf@kde.org>
+# Example::
#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
+# cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST)
#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-include(CMakeParseArguments)
+# Gives::
+#
+# -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
function(CMAKE_PRINT_VARIABLES)
set(msg "")
foreach(var ${ARGN})
if(msg)
- set(msg "${msg} ; ")
+ string(APPEND msg " ; ")
endif()
- set(msg "${msg}${var}=\"${${var}}\"")
+ string(APPEND msg "${var}=\"${${var}}\"")
endforeach()
message(STATUS "${msg}")
endfunction()
@@ -121,21 +120,21 @@ function(CMAKE_PRINT_PROPERTIES )
if(keyword STREQUAL "TARGET")
if(NOT TARGET ${item})
set(itemExists FALSE)
- set(msg "${msg}\n No such TARGET \"${item}\" !\n\n")
+ string(APPEND msg "\n No such TARGET \"${item}\" !\n\n")
endif()
endif()
if (itemExists)
- set(msg "${msg} Properties for ${keyword} ${item}:\n")
+ string(APPEND msg " Properties for ${keyword} ${item}:\n")
foreach(prop ${CPP_PROPERTIES})
get_property(propertySet ${keyword} ${item} PROPERTY "${prop}" SET)
if(propertySet)
get_property(property ${keyword} ${item} PROPERTY "${prop}")
- set(msg "${msg} ${item}.${prop} = \"${property}\"\n")
+ string(APPEND msg " ${item}.${prop} = \"${property}\"\n")
else()
- set(msg "${msg} ${item}.${prop} = <NOTFOUND>\n")
+ string(APPEND msg " ${item}.${prop} = <NOTFOUND>\n")
endif()
endforeach()
endif()