diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-07-13 14:22:10 (GMT) |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-07-13 15:43:17 (GMT) |
commit | f6969b917d5d74c11207b977e7a8168f24b797dc (patch) | |
tree | 9c4eb06e1b2e1dbfbe6c5f9946b37d53dcb59d8f /Tests/Properties | |
parent | 46f1fa01dad3253fd7a748a765dc46b000ea67d4 (diff) | |
download | CMake-f6969b917d5d74c11207b977e7a8168f24b797dc.zip CMake-f6969b917d5d74c11207b977e7a8168f24b797dc.tar.gz CMake-f6969b917d5d74c11207b977e7a8168f24b797dc.tar.bz2 |
set_property: Deduplicate source file directory scopes
A user could specify the same directory scope to set_property()
multiple times, which in conjunction with APPEND would append the
property multiple times.
Make sure to deduplicate scopes across both DIRECTORY and
TARGET_DIRECTORY options, so that a property is only appended
once in such a scenario.
Fixes: #20941
Diffstat (limited to 'Tests/Properties')
-rw-r--r-- | Tests/Properties/CMakeLists.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt index 74d99fa..162a178 100644 --- a/Tests/Properties/CMakeLists.txt +++ b/Tests/Properties/CMakeLists.txt @@ -261,6 +261,25 @@ function(check_get_property_value expected) endif() endfunction() +# Check that source file directory scopes are deduplicated. +set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp" + DIRECTORY SubDir2 SubDir2 SubDir2 + TARGET_DIRECTORY set_prop_lib_3 set_prop_lib_3 set_prop_lib_3 + APPEND + PROPERTY NON_DUPLICATED_CUSTOM_PROP 1 +) + +get_property(actual + SOURCE "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp" + DIRECTORY SubDir2 + PROPERTY NON_DUPLICATED_CUSTOM_PROP) +check_get_property_value("1") + +get_source_file_property(actual "${CMAKE_CURRENT_BINARY_DIR}/src32.cpp" + TARGET_DIRECTORY set_prop_lib_3 + NON_DUPLICATED_CUSTOM_PROP) +check_get_property_value("1") + # Get property + target directory get_property(actual SOURCE "${src_prefix}/src1.cpp" |