summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:27 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:20:27 +0900
commitf7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87 (patch)
treea0d779b32b006b5dbbc54a95cce0cd5d0309eebf /Tests
parent50e508f0913d5580aa156327527da3d29a66b90c (diff)
downloadcmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.tar.gz
cmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.tar.bz2
cmake-f7fbee1ce7e4f73a5a46681cf010a9ac85c3ad87.zip
Imported Upstream version 3.19.1upstream/3.19.1
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-Common.cmake5
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt14
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt20
-rw-r--r--Tests/RunCMake/CMP0111/main.cpp3
-rw-r--r--Tests/RunCMake/CMP0111/module.cpp4
-rw-r--r--Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake5
-rw-r--r--Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/add_custom_command/PrintDir.cmake1
-rw-r--r--Tests/RunCMake/add_custom_command/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory.cmake9
-rw-r--r--Tests/SetLang/CMakeLists.txt7
-rw-r--r--Tests/SetLang/bar.c14
-rw-r--r--Tests/SetLang/zoom.zzz7
15 files changed, 68 insertions, 39 deletions
diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
index 564169d80..c31e4ba03 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
+++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
@@ -4,6 +4,7 @@ set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder")
add_library(unknown_lib UNKNOWN IMPORTED)
add_library(static_lib STATIC IMPORTED)
add_library(shared_lib SHARED IMPORTED)
+add_library(interface_lib INTERFACE IMPORTED)
-add_executable(executable main.cpp)
-target_link_libraries(executable unknown_lib static_lib shared_lib)
+add_library(module MODULE module.cpp)
+target_link_libraries(module unknown_lib static_lib shared_lib interface_lib)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
index ba5d9369f..91a90e57a 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
+++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
@@ -1,7 +1,17 @@
+^CMake Error in CMakeLists.txt:
+ IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
+ "[^"]+")?.
++
CMake Error in CMakeLists.txt:
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
- ".+")?.
+ "[^"]+")?.
+
CMake Error in CMakeLists.txt:
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
- ".+")?.
+ "[^"]+")?.(
++
+CMake Error in CMakeLists.txt:
+ IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
+ "[^"]+")?.)*
++
+CMake Generate step failed. Build files cannot be regenerated correctly.$
diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
index 3abca0ab0..27af91108 100644
--- a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
+++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
@@ -1,11 +1,11 @@
-CMake Warning \(dev\) in CMakeLists.txt:
+^CMake Warning \(dev\) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration
- ".+")?.
+ "[^"]+")?.
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) in CMakeLists.txt:
@@ -15,7 +15,7 @@ CMake Warning \(dev\) in CMakeLists.txt:
warning.
IMPORTED_LOCATION not set for imported target "static_lib"( configuration
- ".+")?.
+ "[^"]+")?.
This warning is for project developers. Use -Wno-dev to suppress it.
+
CMake Warning \(dev\) in CMakeLists.txt:
@@ -25,5 +25,15 @@ CMake Warning \(dev\) in CMakeLists.txt:
warning.
IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration
- ".+")?.
-This warning is for project developers. Use -Wno-dev to suppress it.
+ "[^"]+")?.
+This warning is for project developers. Use -Wno-dev to suppress it.(
++
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0111 is not set: An imported target missing its location property
+ fails during generation. Run "cmake --help-policy CMP0111" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+
+ IMPORTED_(LOCATION|IMPLIB) not set for imported target "(unknown|static|shared)_lib"( configuration
+ "[^"]+")?.
+This warning is for project developers. Use -Wno-dev to suppress it.)*$
diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp
deleted file mode 100644
index 5047a34e3..000000000
--- a/Tests/RunCMake/CMP0111/main.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-int main()
-{
-}
diff --git a/Tests/RunCMake/CMP0111/module.cpp b/Tests/RunCMake/CMP0111/module.cpp
new file mode 100644
index 000000000..b82bb3121
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/module.cpp
@@ -0,0 +1,4 @@
+int module()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
new file mode 100644
index 000000000..12368a29b
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+add_library(empty STATIC empty.c)
+string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
index b540a0450..9e7e73219 100644
--- a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake)
+run_cmake(CustomCompileRule)
diff --git a/Tests/RunCMake/add_custom_command/PrintDir.cmake b/Tests/RunCMake/add_custom_command/PrintDir.cmake
new file mode 100644
index 000000000..0a7b64607
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/PrintDir.cmake
@@ -0,0 +1 @@
+message(STATUS "WorkingDir='${CMAKE_CURRENT_BINARY_DIR}'")
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 96642faf1..aac085dc1 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -27,3 +27,18 @@ set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
+
+if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
+ run_cmake(WorkingDirectory)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/WorkingDirectory-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake-stdout-file WorkingDirectory-build-multi-config-stdout.txt)
+ else()
+ set(RunCMake-stdout-file WorkingDirectory-build-single-config-stdout.txt)
+ endif()
+ run_cmake_command(WorkingDirectory-build ${CMAKE_COMMAND} --build . --config Debug)
+ unset(RunCMake-stdout-file)
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endif()
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
new file mode 100644
index 000000000..95ecf424f
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build/Debug'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
new file mode 100644
index 000000000..1db56ae25
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
new file mode 100644
index 000000000..65b72506e
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
@@ -0,0 +1,9 @@
+add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
+add_custom_command(
+ OUTPUT out.txt
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake
+ WORKING_DIRECTORY ${CMAKE_CFG_INTDIR}
+ )
+set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
+add_custom_target(drive ALL DEPENDS out.txt)
+add_dependencies(drive mkdir)
diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt
index 616421ed5..9de4fc61d 100644
--- a/Tests/SetLang/CMakeLists.txt
+++ b/Tests/SetLang/CMakeLists.txt
@@ -15,10 +15,3 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQU
add_library(stay stay_c.c stay_cxx.cxx)
set_property(TARGET stay PROPERTY COMPILE_OPTIONS "-TP")
endif()
-
-if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI|XL)"))
- add_library(zoom zoom.zzz)
- set_source_files_properties(zoom.zzz PROPERTIES LANGUAGE CXX)
- target_link_libraries(SetLang zoom)
- target_compile_definitions(SetLang PRIVATE WITH_ZOOM)
-endif()
diff --git a/Tests/SetLang/bar.c b/Tests/SetLang/bar.c
index 515e8c233..b934356fa 100644
--- a/Tests/SetLang/bar.c
+++ b/Tests/SetLang/bar.c
@@ -1,22 +1,10 @@
#include <stdio.h>
int foo();
-
-#ifdef WITH_ZOOM
-int zoom();
-#endif
-
class A
{
public:
- A()
- {
- this->i = foo();
-#ifdef WITH_ZOOM
- i += zoom();
- i -= zoom();
-#endif
- }
+ A() { this->i = foo(); }
int i;
};
diff --git a/Tests/SetLang/zoom.zzz b/Tests/SetLang/zoom.zzz
deleted file mode 100644
index a0c8899b6..000000000
--- a/Tests/SetLang/zoom.zzz
+++ /dev/null
@@ -1,7 +0,0 @@
-int zoom()
-{
- int r = 10;
- r++;
- int ret = r + 10;
- return ret;
-}