diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-07-18 09:51:38 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-07-21 13:08:28 (GMT) |
commit | af1a4f52be86c0054006ad98a64316b5531e1bf4 (patch) | |
tree | fab6b0e49f6a785fefa784086d4c820fee342430 /Tests | |
parent | 79cba639e88fcdbd3c21c6d3c7f087234873154a (diff) | |
download | CMake-af1a4f52be86c0054006ad98a64316b5531e1bf4.zip CMake-af1a4f52be86c0054006ad98a64316b5531e1bf4.tar.gz CMake-af1a4f52be86c0054006ad98a64316b5531e1bf4.tar.bz2 |
Genex: $<TARGET_PROPERTY> strip emtpy list elements for predefined properties
Fixes: #20951
Diffstat (limited to 'Tests')
3 files changed, 25 insertions, 3 deletions
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index b5eafa6..5571c3d 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -9,11 +9,11 @@ check(test_version_equal_1 "0") check(test_version_equal_2 "1") if(config AND NOT config STREQUAL NoConfig) - if(NOT "${test_imported_includes}" MATCHES "^;*/imported[12]/include/with space;*$") + if(NOT "${test_imported_includes}" MATCHES "^[^;]*/imported[12]/include/with space$") message(SEND_ERROR "test_imported_includes is not correct: ${test_imported_includes}") endif() else() - if(NOT "${test_imported_includes}" MATCHES "^;;$") + if(NOT "${test_imported_includes}" MATCHES "^$") message(SEND_ERROR "test_imported_includes is not an empty list: ${test_imported_includes}") endif() endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake new file mode 100644 index 0000000..ecf7bfe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES-check.cmake @@ -0,0 +1,17 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/out.txt" content) + +unset(RunCMake_TEST_FAILED) + +if (NOT content MATCHES "(INCLUDES1:${RunCMake_TEST_SOURCE_DIR}/include)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES1: \"${CMAKE_MATCH_1}\"\n") +endif() + +if (NOT content MATCHES "(INCLUDES2:><)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES2: \"${CMAKE_MATCH_1}\"\n") +endif() +if (NOT content MATCHES "(INCLUDES3:><)") + string(APPEND RunCMake_TEST_FAILED "wrong content for INCLUDES3: \"${CMAKE_MATCH_1}\"\n") +endif() +if (NOT content MATCHES "(CUSTOM:>;;<)") + string(APPEND RunCMake_TEST_FAILED "wrong content for CUSTOM: \"${CMAKE_MATCH_1}\"\n") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake index cb6f4d8..e9855be 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-INCLUDE_DIRECTORIES.cmake @@ -14,5 +14,10 @@ target_include_directories(foo3 PUBLIC $<TARGET_PROPERTY:foo2,INCLUDE_DIRECTORIE add_library(foo4 STATIC empty.c) target_include_directories(foo4 PUBLIC $<TARGET_PROPERTY:foo3,INCLUDE_DIRECTORIES>) +add_library (foo5 SHARED empty.c) +set_property(TARGET foo5 PROPERTY INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:CUDA>:/include/CUDA>" "$<$<COMPILE_LANGUAGE:Fortran>:/include/Fortran>") +set_property(TARGET foo5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<$<COMPILE_LANGUAGE:CUDA>:/include/CUDA>" "$<$<COMPILE_LANGUAGE:Fortran>:/include/Fortran>") +set_property(TARGET foo5 PROPERTY CUSTOM ";;") + # Evaluate a genex that looks up INCLUDE_DIRECTORIES on multiple targets. -file(GENERATE OUTPUT out.txt CONTENT "$<TARGET_PROPERTY:foo4,INCLUDE_DIRECTORIES>") +file(GENERATE OUTPUT out.txt CONTENT "INCLUDES1:$<TARGET_PROPERTY:foo4,INCLUDE_DIRECTORIES>\nINCLUDES2:>$<TARGET_PROPERTY:foo5,INTERFACE_INCLUDE_DIRECTORIES><\nINCLUDES3:>$<TARGET_PROPERTY:foo5,INCLUDE_DIRECTORIES><\nCUSTOM:>$<TARGET_PROPERTY:foo5,CUSTOM><\n") |