summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt17
-rw-r--r--Tests/GeneratorExpression/check-part3.cmake19
-rw-r--r--Tests/GeneratorExpression/check-part4.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt15
-rw-r--r--Tests/RunCMake/GeneratorExpression/BadIF.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/string/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/string/Timestamp-result.txt1
-rw-r--r--Tests/RunCMake/string/Timestamp-stderr.txt1
-rw-r--r--Tests/RunCMake/string/Timestamp.cmake3
-rw-r--r--Tests/RunCMake/string/TimestampEmpty-result.txt1
-rw-r--r--Tests/RunCMake/string/TimestampEmpty-stderr.txt1
-rw-r--r--Tests/RunCMake/string/TimestampEmpty.cmake3
-rw-r--r--Tests/RunCMake/string/TimestampInvalid-result.txt1
-rw-r--r--Tests/RunCMake/string/TimestampInvalid-stderr.txt1
-rw-r--r--Tests/RunCMake/string/TimestampInvalid.cmake3
-rw-r--r--Tests/RunCMake/string/TimestampInvalid2-result.txt1
-rw-r--r--Tests/RunCMake/string/TimestampInvalid2-stderr.txt1
-rw-r--r--Tests/RunCMake/string/TimestampInvalid2.cmake3
20 files changed, 71 insertions, 17 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index f0d6abf..adc87cd 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/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>>
@@ -246,6 +247,10 @@ add_custom_target(check-part4 ALL
# CMake as command-line argument
-Dtest_shell_path=${path_prefix}$<SHELL_PATH:${test_shell_path}>
-Dpath_prefix=${path_prefix}
+ -Dif_1=$<IF:1,a,b>
+ -Dif_2=$<IF:0,a,b>
+ -Dif_3=$<IF:$<EQUAL:10,30>,a,b>
+ -Dif_4=$<IF:$<EQUAL:30,30>,a,b>
-DWIN32=${WIN32}
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part4.cmake
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index e12d8c6..9014406 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/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")
diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake
index 9e516d5..f5d14dd 100644
--- a/Tests/GeneratorExpression/check-part4.cmake
+++ b/Tests/GeneratorExpression/check-part4.cmake
@@ -13,3 +13,8 @@ if(WIN32)
else()
check(test_shell_path [[/shell/path]])
endif()
+
+check(if_1 "a")
+check(if_2 "b")
+check(if_3 "b")
+check(if_4 "a")
diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-result.txt b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadIF-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt
new file mode 100644
index 0000000..7c7506c
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadIF-stderr.txt
@@ -0,0 +1,15 @@
+CMake Error at BadIF.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<IF:asdf,a,b>
+
+ First parameter to \$<IF> must resolve to exactly one '0' or '1' value.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at BadIF.cmake:2 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<IF:asdf,a>
+
+ \$<IF> expression requires 3 comma separated parameters, but got 2 instead.
diff --git a/Tests/RunCMake/GeneratorExpression/BadIF.cmake b/Tests/RunCMake/GeneratorExpression/BadIF.cmake
new file mode 100644
index 0000000..583f68d
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/BadIF.cmake
@@ -0,0 +1,5 @@
+
+add_custom_target(check ALL COMMAND check
+ $<IF:asdf,a,b>
+ $<IF:asdf,a>
+ )
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index f5584d5..084b5c3 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
+run_cmake(BadIF)
run_cmake(BadCONFIG)
run_cmake(BadOR)
run_cmake(BadAND)
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
index 8067d9d..38a77b0 100644
--- a/Tests/RunCMake/string/RunCMakeTest.cmake
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -6,6 +6,11 @@ run_cmake(AppendNoArgs)
run_cmake(Concat)
run_cmake(ConcatNoArgs)
+run_cmake(Timestamp)
+run_cmake(TimestampEmpty)
+run_cmake(TimestampInvalid)
+run_cmake(TimestampInvalid2)
+
run_cmake(Uuid)
run_cmake(UuidMissingNamespace)
run_cmake(UuidMissingNamespaceValue)
diff --git a/Tests/RunCMake/string/Timestamp-result.txt b/Tests/RunCMake/string/Timestamp-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/string/Timestamp-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/string/Timestamp-stderr.txt b/Tests/RunCMake/string/Timestamp-stderr.txt
new file mode 100644
index 0000000..c12b070
--- /dev/null
+++ b/Tests/RunCMake/string/Timestamp-stderr.txt
@@ -0,0 +1 @@
+RESULT=2005-08-07 23:19:49 Sun Aug 05 day=219 wd=0 week=32 %%I=11
diff --git a/Tests/RunCMake/string/Timestamp.cmake b/Tests/RunCMake/string/Timestamp.cmake
new file mode 100644
index 0000000..1232300
--- /dev/null
+++ b/Tests/RunCMake/string/Timestamp.cmake
@@ -0,0 +1,3 @@
+set(ENV{SOURCE_DATE_EPOCH} "1123456789")
+string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S %a %b %y day=%j wd=%w week=%U %%I=%I" UTC)
+message("RESULT=${RESULT}")
diff --git a/Tests/RunCMake/string/TimestampEmpty-result.txt b/Tests/RunCMake/string/TimestampEmpty-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampEmpty-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/string/TimestampEmpty-stderr.txt b/Tests/RunCMake/string/TimestampEmpty-stderr.txt
new file mode 100644
index 0000000..35cbd3c
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampEmpty-stderr.txt
@@ -0,0 +1 @@
+RESULT=2
diff --git a/Tests/RunCMake/string/TimestampEmpty.cmake b/Tests/RunCMake/string/TimestampEmpty.cmake
new file mode 100644
index 0000000..21b770f
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampEmpty.cmake
@@ -0,0 +1,3 @@
+set(ENV{SOURCE_DATE_EPOCH} "")
+string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC)
+message("RESULT=${RESULT}")
diff --git a/Tests/RunCMake/string/TimestampInvalid-result.txt b/Tests/RunCMake/string/TimestampInvalid-result.txt
new file mode 100644
index 0000000..f64f5d8
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid-result.txt
@@ -0,0 +1 @@
+27
diff --git a/Tests/RunCMake/string/TimestampInvalid-stderr.txt b/Tests/RunCMake/string/TimestampInvalid-stderr.txt
new file mode 100644
index 0000000..75566da
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer
diff --git a/Tests/RunCMake/string/TimestampInvalid.cmake b/Tests/RunCMake/string/TimestampInvalid.cmake
new file mode 100644
index 0000000..ab36270
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid.cmake
@@ -0,0 +1,3 @@
+set(ENV{SOURCE_DATE_EPOCH} "invalid-integer")
+string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC)
+message("RESULT=${RESULT}")
diff --git a/Tests/RunCMake/string/TimestampInvalid2-result.txt b/Tests/RunCMake/string/TimestampInvalid2-result.txt
new file mode 100644
index 0000000..f64f5d8
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid2-result.txt
@@ -0,0 +1 @@
+27
diff --git a/Tests/RunCMake/string/TimestampInvalid2-stderr.txt b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt
new file mode 100644
index 0000000..75566da
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid2-stderr.txt
@@ -0,0 +1 @@
+CMake Error: Cannot parse SOURCE_DATE_EPOCH as integer
diff --git a/Tests/RunCMake/string/TimestampInvalid2.cmake b/Tests/RunCMake/string/TimestampInvalid2.cmake
new file mode 100644
index 0000000..5cc61b8
--- /dev/null
+++ b/Tests/RunCMake/string/TimestampInvalid2.cmake
@@ -0,0 +1,3 @@
+set(ENV{SOURCE_DATE_EPOCH} "123trailing-garbage")
+string(TIMESTAMP RESULT "%Y-%m-%d %H:%M:%S" UTC)
+message("RESULT=${RESULT}")