mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 02:59:22 -05:00
@@ -84,6 +84,7 @@ Properties on Directories
|
|||||||
/prop_dir/RULE_LAUNCH_LINK
|
/prop_dir/RULE_LAUNCH_LINK
|
||||||
/prop_dir/SOURCE_DIR
|
/prop_dir/SOURCE_DIR
|
||||||
/prop_dir/SUBDIRECTORIES
|
/prop_dir/SUBDIRECTORIES
|
||||||
|
/prop_dir/TESTS
|
||||||
/prop_dir/TEST_INCLUDE_FILES
|
/prop_dir/TEST_INCLUDE_FILES
|
||||||
/prop_dir/VARIABLES
|
/prop_dir/VARIABLES
|
||||||
/prop_dir/VS_GLOBAL_SECTION_POST_section
|
/prop_dir/VS_GLOBAL_SECTION_POST_section
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
TESTS
|
||||||
|
-----
|
||||||
|
|
||||||
|
List of tests.
|
||||||
|
|
||||||
|
This read-only property holds a :ref:`;-list <CMake Language Lists>` of tests
|
||||||
|
defined so far by the :command:`add_test` command.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
directory-property-TESTS
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
* The :prop_dir:`TESTS` directory property was added to hold the list of tests defined by
|
||||||
|
command :command:`add_test`.
|
||||||
@@ -3641,6 +3641,20 @@ void cmMakefile::AppendProperty(const std::string& prop, const char* value,
|
|||||||
|
|
||||||
const char* cmMakefile::GetProperty(const std::string& prop) const
|
const char* cmMakefile::GetProperty(const std::string& prop) const
|
||||||
{
|
{
|
||||||
|
// Check for computed properties.
|
||||||
|
static std::string output;
|
||||||
|
if (prop == "TESTS") {
|
||||||
|
std::vector<std::string> keys;
|
||||||
|
// get list of keys
|
||||||
|
std::transform(this->Tests.begin(), this->Tests.end(),
|
||||||
|
std::back_inserter(keys),
|
||||||
|
[](decltype(this->Tests)::value_type const& pair) {
|
||||||
|
return pair.first;
|
||||||
|
});
|
||||||
|
output = cmJoin(keys, ";");
|
||||||
|
return output.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
return this->StateSnapshot.GetDirectory().GetProperty(prop);
|
return this->StateSnapshot.GetDirectory().GetProperty(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,4 +19,12 @@ get_property: -->[^<;]*/Tests/RunCMake/get_property<--
|
|||||||
get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<--
|
get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<--
|
||||||
get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<--
|
get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties-build/directory_properties<--
|
||||||
get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<--
|
get_directory_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<--
|
||||||
get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<--$
|
get_property: -->[^<;]*/Tests/RunCMake/get_property/directory_properties<--
|
||||||
|
get_directory_property: --><--
|
||||||
|
get_property: --><--
|
||||||
|
get_directory_property: -->test1;test2<--
|
||||||
|
get_property: -->test1;test2<--
|
||||||
|
get_directory_property: -->test1;test2;test3<--
|
||||||
|
get_property: -->test1;test2;test3<--
|
||||||
|
get_directory_property: -->Sub/test1;Sub/test2<--
|
||||||
|
get_property: -->Sub/test1;Sub/test2<--$
|
||||||
|
|||||||
@@ -28,3 +28,12 @@ check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" BINARY_DIR)
|
|||||||
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" SOURCE_DIR)
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" SOURCE_DIR)
|
||||||
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" BINARY_DIR)
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" BINARY_DIR)
|
||||||
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" SOURCE_DIR)
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" SOURCE_DIR)
|
||||||
|
|
||||||
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS)
|
||||||
|
add_test(NAME test1 COMMAND "${CMAKE_COMMAND}" -E echo "test1")
|
||||||
|
add_test(NAME test2 COMMAND "${CMAKE_COMMAND}" -E echo "test2")
|
||||||
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS)
|
||||||
|
add_test(NAME test3 COMMAND "${CMAKE_COMMAND}" -E echo "test3")
|
||||||
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}" TESTS)
|
||||||
|
|
||||||
|
check_directory_property("${CMAKE_CURRENT_SOURCE_DIR}/directory_properties" TESTS)
|
||||||
|
|||||||
@@ -4,3 +4,6 @@ subdirs(sub2)
|
|||||||
add_custom_target(CustomSub)
|
add_custom_target(CustomSub)
|
||||||
add_library(InterfaceSub INTERFACE)
|
add_library(InterfaceSub INTERFACE)
|
||||||
add_library(my::InterfaceSub ALIAS InterfaceSub)
|
add_library(my::InterfaceSub ALIAS InterfaceSub)
|
||||||
|
|
||||||
|
add_test(Sub/test1 COMMAND "${CMAKE_COMMAND}" -E echo "Sub/test1")
|
||||||
|
add_test(Sub/test2 COMMAND "${CMAKE_COMMAND}" -E echo "Sub/test2")
|
||||||
|
|||||||
Reference in New Issue
Block a user