summaryrefslogtreecommitdiffstats
path: root/Tests/Properties
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-22 16:57:50 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-23 13:25:42 (GMT)
commitf2daa025e3bf05f89a745e6a65fea9537e0a035d (patch)
tree2e7528043c7ee905e3777e53e11698f8b81a9a57 /Tests/Properties
parent0cb7216b9f016d5749209227502e499b53b33841 (diff)
downloadCMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.zip
CMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.tar.gz
CMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.tar.bz2
{get,set}_property: Add support for referencing binary directories
Index directories by their binary directory path in addition to their source directory path. Fixes: #19262
Diffstat (limited to 'Tests/Properties')
-rw-r--r--Tests/Properties/CMakeLists.txt28
-rw-r--r--Tests/Properties/SubDir/CMakeLists.txt2
2 files changed, 30 insertions, 0 deletions
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index 162a178..a1158c6 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -165,6 +165,34 @@ add_library(maindirtest SHARED)
generate_file_for_set_property_test(32 maindirtest)
generate_file_for_set_property_test(33 maindirtest)
+# Set/get properties by binary directory path.
+add_subdirectory(SubDir SubDirA)
+get_property(dir_prop_top DIRECTORY PROPERTY dir_prop_top)
+if(NOT dir_prop_top STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirA")
+ message(SEND_ERROR "dir_prop_top unexpected value after SubDirA:\n ${dir_prop_top}")
+endif()
+add_subdirectory(SubDir SubDirB)
+get_property(dir_prop_top DIRECTORY PROPERTY dir_prop_top)
+if(NOT dir_prop_top STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirB")
+ message(SEND_ERROR "dir_prop_top unexpected value after SubDirB:\n ${dir_prop_top}")
+endif()
+get_property(dir_prop_subA DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SubDirA PROPERTY dir_prop_sub)
+if(NOT dir_prop_subA STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirA")
+ message(SEND_ERROR "SubDirA property dir_prop_sub incorrect:\n ${dir_prop_subA}")
+endif()
+get_property(dir_prop_subB DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SubDirB PROPERTY dir_prop_sub)
+if(NOT dir_prop_subB STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirB")
+ message(SEND_ERROR "SubDirB property dir_prop_sub incorrect:\n ${dir_prop_subB}")
+endif()
+get_directory_property(dir_prop_subA DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SubDirA dir_prop_sub)
+if(NOT dir_prop_subA STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirA")
+ message(SEND_ERROR "SubDirA property dir_prop_sub incorrect:\n ${dir_prop_subA}")
+endif()
+get_directory_property(dir_prop_subB DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SubDirB dir_prop_sub)
+if(NOT dir_prop_subB STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/SubDirB")
+ message(SEND_ERROR "SubDirB property dir_prop_sub incorrect:\n ${dir_prop_subB}")
+endif()
+
add_subdirectory(SubDir2)
set(src_prefix "${CMAKE_CURRENT_BINARY_DIR}/SubDir2/")
diff --git a/Tests/Properties/SubDir/CMakeLists.txt b/Tests/Properties/SubDir/CMakeLists.txt
new file mode 100644
index 0000000..f34cc8c
--- /dev/null
+++ b/Tests/Properties/SubDir/CMakeLists.txt
@@ -0,0 +1,2 @@
+set_property(DIRECTORY PROPERTY dir_prop_sub ${CMAKE_CURRENT_BINARY_DIR})
+set_property(DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY dir_prop_top ${CMAKE_CURRENT_BINARY_DIR})