summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/get_property.rst31
-rw-r--r--Help/command/get_source_file_property.rst41
-rw-r--r--Help/command/set_property.rst32
-rw-r--r--Help/command/set_source_files_properties.rst36
-rw-r--r--Source/cmMakefile.cxx3
-rw-r--r--Source/cmMakefileProfilingData.cxx2
-rw-r--r--Source/cmakemain.cxx4
-rw-r--r--Tests/RunCMake/CommandLine/ProfilingTest-check.cmake13
-rw-r--r--Tests/RunCMake/CommandLine/ProfilingTest.cmake6
-rw-r--r--Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake15
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt7
13 files changed, 134 insertions, 65 deletions
diff --git a/Help/command/get_property.rst b/Help/command/get_property.rst
index 123cd45..0602518 100644
--- a/Help/command/get_property.rst
+++ b/Help/command/get_property.rst
@@ -10,7 +10,7 @@ Get a property.
DIRECTORY [<dir>] |
TARGET <target> |
SOURCE <source> |
- [TARGET_DIRECTORY <target> | DIRECTORY <dir>] |
+ [DIRECTORY <dir> | TARGET_DIRECTORY <target>] |
INSTALL <file> |
TEST <test> |
CACHE <entry> |
@@ -31,18 +31,36 @@ It must be one of the following:
Scope defaults to the current directory but another
directory (already processed by CMake) may be named by the
full or relative path ``<dir>``.
+ See also the :command:`get_directory_property` command.
``TARGET``
Scope must name one existing target.
+ See also the :command:`get_target_property` command.
``SOURCE``
- Scope must name one source file.
+ Scope must name one source file. By default, the source file's property
+ will be read from the current source directory's scope, but this can be
+ overridden with one of the following sub-options:
+
+ ``DIRECTORY <dir>``
+ The source file property will be read from the ``<dir>`` directory's
+ scope. CMake must already know about that source directory, either by
+ having added it through a call to :command:`add_subdirectory` or ``<dir>``
+ being the top level source directory. Relative paths are treated as
+ relative to the current source directory.
+
+ ``TARGET_DIRECTORY <target>``
+ The source file property will be read from the directory scope in which
+ ``<target>`` was created (``<target>`` must therefore already exist).
+
+ See also the :command:`get_source_file_property` command.
``INSTALL``
Scope must name one installed file path.
``TEST``
Scope must name one existing test.
+ See also the :command:`get_test_property` command.
``CACHE``
Scope must name one cache entry.
@@ -50,15 +68,6 @@ It must be one of the following:
``VARIABLE``
Scope is unique and does not accept a name.
-In the ``SOURCE`` case, the queried source file scope can be changed by
-specifying one of the additional options: ``DIRECTORY`` or ``TARGET_DIRECTORY``.
-
-``DIRECTORY`` takes a path to a processed directory, and the source file property
-will be read from that directory scope.
-
-``TARGET_DIRECTORY`` takes the name of an existing target. The source file
-property will be read from this target's directory scope.
-
The required ``PROPERTY`` option is immediately followed by the name of
the property to get. If the property is not set an empty value is
returned, although some properties support inheriting from a parent scope
diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst
index 1060251..76ed776 100644
--- a/Help/command/get_source_file_property.rst
+++ b/Help/command/get_source_file_property.rst
@@ -5,24 +5,33 @@ Get a property for a source file.
.. code-block:: cmake
- get_source_file_property(VAR file [TARGET_DIRECTORY <target> | DIRECTORY <dir>] property)
+ get_source_file_property(<variable> <file>
+ [DIRECTORY <dir> | TARGET_DIRECTORY <target>]
+ <property>)
Gets a property from a source file. The value of the property is
-stored in the variable ``VAR``. If the source property is not found, the
-behavior depends on whether it has been defined to be an ``INHERITED`` property
-or not (see :command:`define_property`). Non-inherited properties will set
-``VAR`` to "NOTFOUND", whereas inherited properties will search the relevant
-parent scope as described for the :command:`define_property` command and
-if still unable to find the property, ``VAR`` will be set to an empty string.
-
-The queried source file scope can be changed by specifying one of the
-additional options: ``DIRECTORY`` or ``TARGET_DIRECTORY``.
-
-``DIRECTORY`` takes a path to a processed directory, and the source file property
-will be read from that directory scope.
-
-``TARGET_DIRECTORY`` takes the name of an existing target. The source file
-property will be read from this target's directory scope.
+stored in the specified ``<variable>``. If the source property is not found,
+the behavior depends on whether it has been defined to be an ``INHERITED``
+property or not (see :command:`define_property`). Non-inherited properties
+will set ``variable`` to ``NOTFOUND``, whereas inherited properties will search
+the relevant parent scope as described for the :command:`define_property`
+command and if still unable to find the property, ``variable`` will be set to
+an empty string.
+
+By default, the source file's property will be read from the current source
+directory's scope, but this can be overridden with one of the following
+sub-options:
+
+``DIRECTORY <dir>``
+ The source file property will be read from the ``<dir>`` directory's
+ scope. CMake must already know about that source directory, either by
+ having added it through a call to :command:`add_subdirectory` or ``<dir>``
+ being the top level source directory. Relative paths are treated as
+ relative to the current source directory.
+
+``TARGET_DIRECTORY <target>``
+ The source file property will be read from the directory scope in which
+ ``<target>`` was created (``<target>`` must therefore already exist).
Use :command:`set_source_files_properties` to set property values. Source
file properties usually control how the file is built. One property that is
diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst
index ccbd635..93c2d9c 100644
--- a/Help/command/set_property.rst
+++ b/Help/command/set_property.rst
@@ -9,13 +9,13 @@ Set a named property in a given scope.
DIRECTORY [<dir>] |
TARGET [<target1> ...] |
SOURCE [<src1> ...]
- [TARGET_DIRECTORY <target1> ...]
- [DIRECTORY <dir1> ...] |
+ [DIRECTORY <dirs> ...] |
+ [TARGET_DIRECTORY <targets> ...]
INSTALL [<file1> ...] |
TEST [<test1> ...] |
CACHE [<entry1> ...] >
[APPEND] [APPEND_STRING]
- PROPERTY <name> [value1 ...])
+ PROPERTY <name> [<value1> ...])
Sets one property on zero or more objects of a scope.
@@ -35,17 +35,23 @@ It must be one of the following:
See also the :command:`set_target_properties` command.
``SOURCE``
- Scope may name zero or more source files. Note that source
- file properties are by default visible only to targets added in the same
- directory (``CMakeLists.txt``).
- The file properties can be made visible in a different directory by specifying
- one or both of the additional options: ``TARGET_DIRECTORY`` and ``DIRECTORY``.
+ Scope may name zero or more source files. By default, source file properties
+ are only visible to targets added in the same directory (``CMakeLists.txt``).
+ Visibility can be set in other directory scopes using one or both of the
+ following sub-options:
+
+ ``DIRECTORY <dirs>...``
+ The source file property will be set in each of the ``<dirs>``
+ directories' scopes. CMake must already know about each of these
+ source directories, either by having added them through a call to
+ :command:`add_subdirectory` or it being the top level source directory.
+ Relative paths are treated as relative to the current source directory.
+
+ ``TARGET_DIRECTORY <targets>...``
+ The source file property will be set in each of the directory scopes
+ where any of the specified ``<targets>`` were created (the ``<targets>``
+ must therefore already exist).
- ``DIRECTORY`` takes a list of processed directories paths, and sets the file
- properties in those directory scopes.
-
- ``TARGET_DIRECTORY`` takes a list of existing targets. The file
- properties will be set in these targets' directory scopes.
See also the :command:`set_source_files_properties` command.
``INSTALL``
diff --git a/Help/command/set_source_files_properties.rst b/Help/command/set_source_files_properties.rst
index 59d5ba3..9558b40 100644
--- a/Help/command/set_source_files_properties.rst
+++ b/Help/command/set_source_files_properties.rst
@@ -5,29 +5,33 @@ Source files can have properties that affect how they are built.
.. code-block:: cmake
- set_source_files_properties([file1 [file2 [...]]]
- [TARGET_DIRECTORY <target1> ...]
- [DIRECTORY <dir1> ...]
- PROPERTIES prop1 value1
- [prop2 value2 [...]])
+ set_source_files_properties(<files> ...
+ [DIRECTORY <dirs> ...]
+ [TARGET_DIRECTORY <targets> ...]
+ PROPERTIES <prop1> <value1>
+ [<prop2> <value2>] ...)
Sets properties associated with source files using a key/value paired
list.
-Note that source file properties are by default visible only to
-targets added in the same directory (``CMakeLists.txt``).
+By default, source file properties are only visible to targets added in the
+same directory (``CMakeLists.txt``). Visibility can be set in other directory
+scopes using one or both of the following options:
-The file properties can be made visible in a different directory by specifying
-one or both of the additional options: ``TARGET_DIRECTORY`` and ``DIRECTORY``.
+``DIRECTORY <dirs>...``
+ The source file properties will be set in each of the ``<dirs>``
+ directories' scopes. CMake must already know about each of these
+ source directories, either by having added them through a call to
+ :command:`add_subdirectory` or it being the top level source directory.
+ Relative paths are treated as relative to the current source directory.
-``DIRECTORY`` takes a list of processed directories paths, and sets the file
-properties in those directory scopes.
-
-``TARGET_DIRECTORY`` takes a list of existing targets. The file
-properties will be set in these targets' directory scopes.
+``TARGET_DIRECTORY <targets>...``
+ The source file properties will be set in each of the directory scopes
+ where any of the specified ``<targets>`` were created (the ``<targets>``
+ must therefore already exist).
+Use :command:`get_source_file_property` to get property values.
See also the :command:`set_property(SOURCE)` command.
See :ref:`Source File Properties` for the list of properties known
-to CMake. Source file properties are visible only to targets added
-in the same directory (``CMakeLists.txt``).
+to CMake.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c78b751..db5cee9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1461,6 +1461,9 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
// Imported targets.
this->ImportedTargets = parent->ImportedTargets;
+ // Non-global Alias targets.
+ this->AliasTargets = parent->AliasTargets;
+
// Recursion depth.
this->RecursionDepth = parent->RecursionDepth;
}
diff --git a/Source/cmMakefileProfilingData.cxx b/Source/cmMakefileProfilingData.cxx
index e0150dc..29fd440 100644
--- a/Source/cmMakefileProfilingData.cxx
+++ b/Source/cmMakefileProfilingData.cxx
@@ -58,7 +58,7 @@ void cmMakefileProfilingData::StartEntry(const cmListFileFunction& lff,
cmsys::SystemInformation info;
Json::Value v;
v["ph"] = "B";
- v["name"] = lff.Name.Original;
+ v["name"] = lff.Name.Lower;
v["cat"] = "cmake";
v["ts"] = Json::Value::UInt64(
std::chrono::duration_cast<std::chrono::microseconds>(
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index e0c17f8..d662a9a 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -97,7 +97,9 @@ const char* cmDocumentationOptions[][2] = {
"Find problems with variable usage in system "
"files." },
# if !defined(CMAKE_BOOTSTRAP)
- { "--profiling-format=<fmt>", "Output data for profiling CMake scripts." },
+ { "--profiling-format=<fmt>",
+ "Output data for profiling CMake scripts. Supported formats: "
+ "google-trace" },
{ "--profiling-output=<file>",
"Select an output path for the profiling data enabled through "
"--profiling-format." },
diff --git a/Tests/RunCMake/CommandLine/ProfilingTest-check.cmake b/Tests/RunCMake/CommandLine/ProfilingTest-check.cmake
index 19ece86..2e8eac1 100644
--- a/Tests/RunCMake/CommandLine/ProfilingTest-check.cmake
+++ b/Tests/RunCMake/CommandLine/ProfilingTest-check.cmake
@@ -16,3 +16,16 @@ if (NOT JSON_TRAILER MATCHES "^}]$")
set(RunCMake_TEST_FAILED "Expected valid JSON end")
return()
endif()
+
+file(STRINGS ${ProfilingTestOutput} upperCaseCommand
+ REGEX [["name"[ ]*:[ ]*"__TESTING_COMMAND_CASE"]])
+if (NOT "${upperCaseCommand}" STREQUAL "")
+ set(RunCMake_TEST_FAILED "Command name not stored in lowercase")
+endif()
+file(STRINGS ${ProfilingTestOutput} lowerCaseCommand
+ REGEX [["name"[ ]*:[ ]*"__testing_command_case"]])
+list(LENGTH lowerCaseCommand numInvocations)
+if (NOT numInvocations EQUAL 1)
+ set(RunCMake_TEST_FAILED
+ "Unexpected number of lowercase command names: ${numInvocations}")
+endif()
diff --git a/Tests/RunCMake/CommandLine/ProfilingTest.cmake b/Tests/RunCMake/CommandLine/ProfilingTest.cmake
index 837f4bf..4cf0c30 100644
--- a/Tests/RunCMake/CommandLine/ProfilingTest.cmake
+++ b/Tests/RunCMake/CommandLine/ProfilingTest.cmake
@@ -1 +1,5 @@
-# This file is intentionally left blank
+function(__testing_command_case)
+endfunction()
+
+# This must not appear in the profiling output as uppercase
+__TESTING_COMMAND_CASE()
diff --git a/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt b/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt
index bfd9840..b114b75 100644
--- a/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt
+++ b/Tests/RunCMake/alias_targets/get_property-subdir/CMakeLists.txt
@@ -6,3 +6,10 @@ check_property (alias::import-local-subdir ALIASED_TARGET "import-local")
check_property (alias::import-local-subdir IMPORTED "TRUE")
check_property (alias::import-local-subdir ALIAS_GLOBAL "FALSE")
check_property (alias::import-local-subdir IMPORT_LOCAL_PROPERTY "IMPORT_LOCAL")
+
+
+# non-global alias defined in parent directory must be visible in sub-directory
+check_property (alias::import-local ALIASED_TARGET "import-local")
+check_property (alias::import-local IMPORTED "TRUE")
+check_property (alias::import-local ALIAS_GLOBAL "FALSE")
+check_property (alias::import-local IMPORT_LOCAL_PROPERTY "IMPORT_LOCAL")
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake
index 73f8a7d..316b74b 100644
--- a/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake
@@ -15,22 +15,25 @@ endif()
add_library(import-local SHARED IMPORTED)
set_property(TARGET import-local PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}")
set_property(TARGET import-local PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}")
-add_library(alias-local ALIAS import-local)
+add_library(alias::local ALIAS import-local)
add_library (lib-local SHARED lib.c)
-target_link_libraries (lib-local PRIVATE import-local)
+target_link_libraries (lib-local PRIVATE alias::local)
add_executable (main-local main.c)
-target_link_libraries (main-local PRIVATE import-local)
+target_link_libraries (main-local PRIVATE alias::local)
add_library(import-global SHARED IMPORTED GLOBAL)
set_property(TARGET import-global PROPERTY IMPORTED_LOCATION "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_SHARED_LIBRARY_SUFFIX}")
set_property(TARGET import-global PROPERTY IMPORTED_IMPLIB "${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}func${CMAKE_IMPORT_LIBRARY_SUFFIX}")
-add_library(alias-global ALIAS import-global)
+add_library(alias::global ALIAS import-global)
add_library (lib-global SHARED lib.c)
-target_link_libraries (lib-global PRIVATE import-global)
+target_link_libraries (lib-global PRIVATE alias::global)
add_executable (main-global main.c)
-target_link_libraries (main-global PRIVATE import-global)
+target_link_libraries (main-global PRIVATE alias::global)
+
+
+add_subdirectory(sub_dir)
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake
index 4d24a6e..42ec47e 100644
--- a/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake
@@ -19,5 +19,7 @@ run_cmake_target(AliasTargets lib-local lib-local --config Release)
run_cmake_target(AliasTargets main-local main-local --config Release)
run_cmake_target(AliasTargets lib-global lib-global --config Release)
run_cmake_target(AliasTargets main-global main-global --config Release)
+run_cmake_target(AliasTargets lib-sub lib-sub --config Release)
+run_cmake_target(AliasTargets main-sub main-sub --config Release)
unset(RunCMake_TEST_OPTIONS)
unset(RunCMake_TEST_OUTPUT_MERGE)
diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt b/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt
new file mode 100644
index 0000000..326e964
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries-ALIAS/sub_dir/CMakeLists.txt
@@ -0,0 +1,7 @@
+
+
+add_library (lib-sub SHARED ../lib.c)
+target_link_libraries (lib-sub PRIVATE alias::local)
+
+add_executable (main-sub ../main.c)
+target_link_libraries (main-sub PRIVATE alias::local)