summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake1
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-Common.cmake9
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt7
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt26
-rw-r--r--Tests/RunCMake/CMP0111/CMP0111-WARN.cmake1
-rw-r--r--Tests/RunCMake/CMP0111/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0111/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMP0111/main.cpp3
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json4
-rw-r--r--Tests/RunCMake/FileAPI/imported/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/Graphviz/GraphvizTestProject.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake1
21 files changed, 81 insertions, 11 deletions
diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
index 650c8a5..ae62e79 100644
--- a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
+++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
@@ -1,6 +1,7 @@
enable_language(CXX)
+cmake_policy(SET CMP0111 OLD)
add_library(someimportedlib SHARED IMPORTED)
get_target_property(_loc someimportedlib LOCATION)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
new file mode 100644
index 0000000..564169d
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake
@@ -0,0 +1,9 @@
+# Prevent duplicate errors on some platforms.
+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_executable(executable main.cpp)
+target_link_libraries(executable unknown_lib static_lib shared_lib)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
new file mode 100644
index 0000000..ba5d936
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt
@@ -0,0 +1,7 @@
+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
+ ".+")?.
diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake
new file mode 100644
index 0000000..d0c8dd3
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0111 NEW)
+include(CMP0111-Common.cmake)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake
new file mode 100644
index 0000000..d00847a
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0111 OLD)
+include(CMP0111-Common.cmake)
diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
new file mode 100644
index 0000000..2fe6cc8
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt
@@ -0,0 +1,26 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ Policy CMP0111 is not set: An imported target with a missing location 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:
+ Policy CMP0111 is not set: An imported target with a missing location 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 "static_lib"( configuration
+ ".+")?.
+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 with a missing location 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_IMPLIB not set for imported target "shared_lib"( configuration
+ ".+")?.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake
new file mode 100644
index 0000000..0efe48c
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake
@@ -0,0 +1 @@
+include(CMP0111-Common.cmake)
diff --git a/Tests/RunCMake/CMP0111/CMakeLists.txt b/Tests/RunCMake/CMP0111/CMakeLists.txt
new file mode 100644
index 0000000..9f19a75
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.17)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0111/RunCMakeTest.cmake b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake
new file mode 100644
index 0000000..02e420a
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0111-OLD)
+run_cmake(CMP0111-NEW)
+run_cmake(CMP0111-WARN)
diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp
new file mode 100644
index 0000000..5047a34
--- /dev/null
+++ b/Tests/RunCMake/CMP0111/main.cpp
@@ -0,0 +1,3 @@
+int main()
+{
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index bbb1952..bee3875 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -124,6 +124,7 @@ if(CMake_TEST_CUDA)
PROPERTY LABELS "CUDA")
endif()
add_RunCMake_test(CMP0106)
+add_RunCMake_test(CMP0111)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json
index 312f4c5..451e8d4 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 5,
+ "line": 6,
"command": "add_executable",
"hasParent": true
},
@@ -49,7 +49,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 5,
+ "line": 6,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json
index 7d0e6df..cbd4346 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 23,
+ "line": 29,
"command": "add_executable",
"hasParent": true
},
@@ -49,7 +49,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 23,
+ "line": 29,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json
index 4aec524..d92a810 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 18,
+ "line": 24,
"command": "add_executable",
"hasParent": true
},
@@ -49,7 +49,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 18,
+ "line": 24,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json
index f5846ec..1197a73 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 9,
+ "line": 14,
"command": "add_executable",
"hasParent": true
},
@@ -49,7 +49,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 9,
+ "line": 14,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json
index 29a1695..42564e0 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json
@@ -14,7 +14,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 13,
+ "line": 19,
"command": "add_executable",
"hasParent": true
},
@@ -49,7 +49,7 @@
"backtrace": [
{
"file": "^imported/CMakeLists\\.txt$",
- "line": 13,
+ "line": 19,
"command": "add_executable",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt
index d36d88b..f79d87c 100644
--- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt
@@ -1,15 +1,21 @@
project(Imported)
add_library(imported_lib UNKNOWN IMPORTED)
+set_target_properties(imported_lib PROPERTIES IMPORTED_LOCATION "imported_unk${CMAKE_STATIC_LIBRARY_SUFFIX}")
add_executable(imported_exe IMPORTED)
add_executable(link_imported_exe ../empty.c)
target_link_libraries(link_imported_exe PRIVATE imported_lib)
add_library(imported_shared_lib SHARED IMPORTED)
+set_target_properties(imported_shared_lib PROPERTIES
+ IMPORTED_LOCATION "imported_shared${CMAKE_SHARED_LIBRARY_SUFFIX}"
+ IMPORTED_IMPLIB "imported_shared${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+)
add_executable(link_imported_shared_exe ../empty.c)
target_link_libraries(link_imported_shared_exe PRIVATE imported_shared_lib)
add_library(imported_static_lib STATIC IMPORTED)
+set_target_properties(imported_static_lib PROPERTIES IMPORTED_LOCATION "imported_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
add_executable(link_imported_static_exe ../empty.c)
target_link_libraries(link_imported_static_exe PRIVATE imported_static_lib)
diff --git a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake
index 8a628cf..2c7d5bf 100644
--- a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake
+++ b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake
@@ -60,6 +60,7 @@ target_link_libraries(ConsoleApplication CoreLibrary)
# No one will ever notice...
add_library(CryptoCurrencyMiningLibrary UNKNOWN IMPORTED)
+set_target_properties(CryptoCurrencyMiningLibrary PROPERTIES IMPORTED_LOCATION "cryptomining${CMAKE_STATIC_LIBRARY_SUFFIX}")
target_link_libraries(ConsoleApplication CryptoCurrencyMiningLibrary)
add_custom_target(GenerateManPage COMMAND ${CMAKE_COMMAND} --version)
diff --git a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake
index bab537e..d6ddfae 100644
--- a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake
+++ b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake
@@ -3,7 +3,8 @@ set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
add_library(imported SHARED IMPORTED)
set_target_properties(imported PROPERTIES
- IMPORTED_LOCATION "imported"
+ IMPORTED_LOCATION "imported${CMAKE_SHARED_LIBRARY_SUFFIX}"
+ IMPORTED_IMPLIB "imported${CMAKE_IMPORT_LIBRARY_SUFFIX}"
IMPORTED_LINK_DEPENDENT_LIBRARIES "/path/to/libSharedDep.so"
)
add_executable(empty empty.c)
diff --git a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake
index f52fa30..608f47b 100644
--- a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake
+++ b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake
@@ -1,4 +1,5 @@
enable_language(C)
add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
+set_target_properties(UnknownImportedGlobal PROPERTIES IMPORTED_LOCATION "unknown.${CMAKE_SHARED_LIBRARY_SUFFIX}")
add_library(mylib empty.c)
target_link_libraries(mylib UnknownImportedGlobal)