summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:08 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:08 +0900
commit7d0194465f58c820df7f2285a2a2167818718da2 (patch)
treebc4ac1640b77e8ed65b626ab6bf102275ac589bc /Tests
parenteca8e526ac4322878cf56b68577e60eb848172fb (diff)
downloadcmake-7d0194465f58c820df7f2285a2a2167818718da2.tar.gz
cmake-7d0194465f58c820df7f2285a2a2167818718da2.tar.bz2
cmake-7d0194465f58c820df7f2285a2a2167818718da2.zip
Imported Upstream version 3.22.3upstream/3.22.3
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt12
-rw-r--r--Tests/RunCMake/if/unbalanced-parenthesis-stderr.txt2
-rw-r--r--Tests/RunCMake/if/unbalanced-parenthesis.cmake11
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake19
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt5
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt5
-rw-r--r--Tests/RunCMake/install/EXPORT-TargetTwice.cmake17
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/while/unbalanced-parenthesis-result.txt1
-rw-r--r--Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt8
-rw-r--r--Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt1
-rw-r--r--Tests/RunCMake/while/unbalanced-parenthesis.cmake13
12 files changed, 67 insertions, 28 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e24ef5850..e8fb13fd0 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -580,12 +580,16 @@ if(NOT WIN32
add_RunCMake_test(SymlinkTrees)
endif ()
-find_package(Qt4 QUIET)
-find_package(Qt5Core QUIET)
-if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
+if(CMake_TEST_Qt4)
+ find_package(Qt4 QUIET)
+endif()
+if(CMake_TEST_Qt5)
+ find_package(Qt5Core QUIET)
+endif()
+if (CMake_TEST_Qt4 AND CMake_TEST_Qt5 AND QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
add_RunCMake_test(IncompatibleQt)
endif()
-if (QT4_FOUND)
+if (CMake_TEST_Qt4 AND QT4_FOUND)
add_RunCMake_test(ObsoleteQtMacros -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
endif()
diff --git a/Tests/RunCMake/if/unbalanced-parenthesis-stderr.txt b/Tests/RunCMake/if/unbalanced-parenthesis-stderr.txt
index 770ccb8f1..d2260a04b 100644
--- a/Tests/RunCMake/if/unbalanced-parenthesis-stderr.txt
+++ b/Tests/RunCMake/if/unbalanced-parenthesis-stderr.txt
@@ -1,7 +1,7 @@
CMake Error at unbalanced-parenthesis\.cmake:[0-9]+ \(if\):
if given arguments:
- "NOT" "\(" "IN_LIST" "some_list"
+ "\("
mismatched parenthesis in condition
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/if/unbalanced-parenthesis.cmake b/Tests/RunCMake/if/unbalanced-parenthesis.cmake
index c51c7557f..45932f662 100644
--- a/Tests/RunCMake/if/unbalanced-parenthesis.cmake
+++ b/Tests/RunCMake/if/unbalanced-parenthesis.cmake
@@ -1,8 +1,5 @@
-set(var_with_paren "(")
-set(some_list "")
-
-if(NOT ${var_with_paren} IN_LIST some_list)
- message(STATUS "Never prints")
-else()
- message(STATUS "Never prints")
+set(paren "(")
+if(${paren})
+ message(STATUS "Condition incorrectly true")
endif()
+message(STATUS "Code incorrectly accepted")
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake b/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake
new file mode 100644
index 000000000..97677cad4
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-check.cmake
@@ -0,0 +1,19 @@
+set(pkg1_cmake "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/pkg1/pkg1.cmake")
+file(STRINGS "${pkg1_cmake}" pkg1_includes REGEX INTERFACE_INCLUDE_DIRECTORIES)
+set(pkg1_expect [[INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg1/inc"]])
+if(NOT pkg1_includes MATCHES "${pkg1_expect}")
+ set(RunCMake_TEST_FAILED "pkg1 has unexpected INTERFACE_INCLUDE_DIRECTORIES line:
+ ${pkg1_includes}
+It does not match:
+ ${pkg1_expect}")
+endif()
+
+set(pkg2_cmake "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/Export/pkg2/pkg2.cmake")
+file(STRINGS "${pkg2_cmake}" pkg2_includes REGEX INTERFACE_INCLUDE_DIRECTORIES)
+set(pkg2_expect [[INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg2/inc"]])
+if(NOT pkg2_includes MATCHES "${pkg2_expect}")
+ set(RunCMake_TEST_FAILED "pkg2 has unexpected INTERFACE_INCLUDE_DIRECTORIES line:
+ ${pkg2_includes}
+It does not match:
+ ${pkg2_expect}")
+endif()
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt
new file mode 100644
index 000000000..592f79c68
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg1.txt
@@ -0,0 +1,5 @@
+.+
+set_target_properties\(pkg1::foo PROPERTIES
+.+INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg1/inc"
+\)
+.+
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt
new file mode 100644
index 000000000..ebfc43e34
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice-pkg2.txt
@@ -0,0 +1,5 @@
+.+
+set_target_properties\(pkg2::foo PROPERTIES
+.+INTERFACE_INCLUDE_DIRECTORIES "\${_IMPORT_PREFIX}/pkg2/inc"
+\)
+.+
diff --git a/Tests/RunCMake/install/EXPORT-TargetTwice.cmake b/Tests/RunCMake/install/EXPORT-TargetTwice.cmake
new file mode 100644
index 000000000..cac4ff2ad
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-TargetTwice.cmake
@@ -0,0 +1,17 @@
+enable_language(C)
+
+add_library(foo STATIC empty.c)
+
+install(TARGETS foo
+ EXPORT pkg1
+ ARCHIVE DESTINATION pkg1/lib
+ INCLUDES DESTINATION pkg1/inc
+ )
+install(EXPORT pkg1 DESTINATION pkg1)
+
+install(TARGETS foo
+ EXPORT pkg2
+ ARCHIVE DESTINATION pkg2/lib
+ INCLUDES DESTINATION pkg2/inc
+ )
+install(EXPORT pkg2 DESTINATION pkg2)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index f79a3ea74..7c12d4a31 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -82,6 +82,7 @@ run_cmake(EXPORT-OldIFace)
run_cmake(EXPORT-UnknownExport)
run_cmake(EXPORT-NamelinkOnly)
run_cmake(EXPORT-SeparateNamelink)
+run_cmake(EXPORT-TargetTwice)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
run_cmake(CMP0062-WARN)
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis-result.txt b/Tests/RunCMake/while/unbalanced-parenthesis-result.txt
deleted file mode 100644
index d00491fd7..000000000
--- a/Tests/RunCMake/while/unbalanced-parenthesis-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt b/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt
deleted file mode 100644
index 9d4132c5a..000000000
--- a/Tests/RunCMake/while/unbalanced-parenthesis-stderr.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-CMake Error at unbalanced-parenthesis.cmake:[0-9]+ \(while\):
- had incorrect arguments:
-
- "NOT" "\(" "IN_LIST" "some_list"
-
- mismatched parenthesis in condition
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt b/Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt
new file mode 100644
index 000000000..d45e194a5
--- /dev/null
+++ b/Tests/RunCMake/while/unbalanced-parenthesis-stdout.txt
@@ -0,0 +1 @@
+-- Code incorrectly accepted
diff --git a/Tests/RunCMake/while/unbalanced-parenthesis.cmake b/Tests/RunCMake/while/unbalanced-parenthesis.cmake
index 7a12701e6..39d736b25 100644
--- a/Tests/RunCMake/while/unbalanced-parenthesis.cmake
+++ b/Tests/RunCMake/while/unbalanced-parenthesis.cmake
@@ -1,8 +1,7 @@
-set(var_with_paren "(")
-set(some_list "")
-
-while(NOT ${var_with_paren} IN_LIST some_list)
- message(STATUS "Never prints")
+set(paren "(")
+while(${paren})
+ message(STATUS "Condition incorrectly true")
+ break()
endwhile()
-
-message(STATUS "Never prints")
+# FIXME(#23296): The above condition error is tolerated for compatibility.
+message(STATUS "Code incorrectly accepted")