Browse Source

Merge topic 'test-GeneratorExpression-update'

c3a22518 Tests: Extend GeneratorExpression to work with more configurations
d4911724 Tests: Teach GeneratorExpression to cover spaces in include dirs
1a2a9b0d Tests: Simplify GeneratorExpression imported include directory check
Brad King 8 years ago
parent
commit
fa9c12933f

+ 7 - 6
Tests/GeneratorExpression/CMakeLists.txt

@@ -145,13 +145,13 @@ add_library(imported1 SHARED IMPORTED)
 set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_RELEASE release_loc)
 set_property(TARGET imported1 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc)
 set_property(TARGET imported1 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
-set_property(TARGET imported1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported1/include)
+set_property(TARGET imported1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/imported1/include/with space")
 
 add_library(imported2 SHARED IMPORTED)
 set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_RELEASE release_loc)
 set_property(TARGET imported2 PROPERTY IMPORTED_LOCATION_DEBUG debug_loc)
 set_property(TARGET imported2 PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG)
-set_property(TARGET imported2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES /imported2/include)
+set_property(TARGET imported2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "/imported2/include/with space")
 
 add_library(imported3 SHARED IMPORTED)
 set_property(TARGET imported3 PROPERTY IMPORTED_LOCATION_RELEASE release_loc)
@@ -161,6 +161,10 @@ set_property(TARGET imported3 APPEND PROPERTY
   INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:DEBUG>:$<TARGET_PROPERTY:imported1,INTERFACE_INCLUDE_DIRECTORIES>>)
 set_property(TARGET imported3 APPEND PROPERTY
   INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:RELEASE>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>)
+set_property(TARGET imported3 APPEND PROPERTY
+  INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:RELWITHDEBINFO>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>)
+set_property(TARGET imported3 APPEND PROPERTY
+  INTERFACE_INCLUDE_DIRECTORIES $<$<CONFIG:MINSIZEREL>:$<TARGET_PROPERTY:imported2,INTERFACE_INCLUDE_DIRECTORIES>>)
 
 add_library(imported4 SHARED IMPORTED)
 set_property(TARGET imported4 APPEND PROPERTY
@@ -187,10 +191,7 @@ add_custom_target(check-part3 ALL
     -Dtest_version_equal_1=$<VERSION_EQUAL:1.0.1,1.1>
     -Dtest_version_equal_2=$<VERSION_EQUAL:1.1,1.1>
     -Dconfig=$<CONFIGURATION>
-    -Dtest_imported_debug=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
-    -Dtest_imported_release=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
-    -Dtest_imported_relwithdebinfo=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
-    -Dtest_imported_minsizerel=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
+    -Dtest_imported_includes=$<TARGET_PROPERTY:imported4,INCLUDE_DIRECTORIES>
     -Dtest_imported_fallback=$<STREQUAL:$<TARGET_FILE_NAME:importedFallback>,fallback_loc>
     -Dtest_alias_file_exe=$<STREQUAL:$<TARGET_FILE:Alias::SomeExe>,$<TARGET_FILE:someexe>>
     -Dtest_alias_file_lib=$<STREQUAL:$<TARGET_FILE:Alias::SomeLib>,$<TARGET_FILE:empty1>>

+ 8 - 11
Tests/GeneratorExpression/check-part3.cmake

@@ -8,18 +8,15 @@ check(test_version_less_2 "1")
 check(test_version_equal_1 "0")
 check(test_version_equal_2 "1")
 
-foreach(c debug release relwithdebinfo minsizerel)
-  if(config AND NOT config STREQUAL NoConfig)
-    if(NOT "${test_imported_${c}}" MATCHES "^;/imported2/include$"
-        AND NOT "${test_imported_${c}}" MATCHES "^/imported1/include;$")
-      message(SEND_ERROR "test_imported_${c} is not correct: ${test_imported_${c}}")
-    endif()
-  else()
-    if(NOT "${test_imported_${c}}" MATCHES "^;$")
-      message(SEND_ERROR "test_imported_${c} is not an empty list: ${test_imported_${c}}")
-    endif()
+if(config AND NOT config STREQUAL NoConfig)
+  if(NOT "${test_imported_includes}" MATCHES "^;*/imported[12]/include/with space;*$")
+    message(SEND_ERROR "test_imported_includes is not correct: ${test_imported_includes}")
   endif()
-endforeach()
+else()
+  if(NOT "${test_imported_includes}" MATCHES "^;;;$")
+    message(SEND_ERROR "test_imported_includes is not an empty list: ${test_imported_includes}")
+  endif()
+endif()
 
 check(test_imported_fallback "1")