summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-07-31 13:17:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-07-31 13:17:35 (GMT)
commit9f575a26fd7019114687104c719b20ef6d26b1fe (patch)
tree9e17ea0a31309c933c402d82515b43ca13a10133 /Tests
parent202b7d12eb0609f1a2dd7f587c0ed17d45bec1c5 (diff)
parentf86850ef60b7dc008a144722bd0c803289a8ab76 (diff)
downloadCMake-9f575a26fd7019114687104c719b20ef6d26b1fe.zip
CMake-9f575a26fd7019114687104c719b20ef6d26b1fe.tar.gz
CMake-9f575a26fd7019114687104c719b20ef6d26b1fe.tar.bz2
Merge topic 'pdb-genex'
f86850ef Genex: Implement generator expressions for target PDB files. 028ad318 Genex: Simplify filesytem artifact code
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt8
-rw-r--r--Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake17
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt1
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake19
11 files changed, 86 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index ff3b9a0..3cd9947 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -21,6 +21,12 @@ if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 2)
set(File_Generate_ARGS -DXCODE_BELOW_2=1)
endif()
+# Test MSVC for older host CMake versions, and test
+# WIN32/CMAKE_C_COMPILER_ID to fix check on Intel for Windows.
+if(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID MATCHES "MSVC|Intel"))
+ set(GeneratorExpression_ARGS -DLINKER_SUPPORTS_PDB=1)
+endif()
+
add_RunCMake_test(CMP0019)
add_RunCMake_test(CMP0022)
add_RunCMake_test(CMP0026)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..831edad
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_FILE:empty>
+
+ TARGET_PDB_FILE is not supported by the target linker.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..84a2b2e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_FILE:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..e5f21e2
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\):
+ Error evaluating generator expression:
+
+ \$<TARGET_PDB_FILE:empty>
+
+ TARGET_PDB_FILE is allowed only for targets with linker created artifacts.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..84a2b2e
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE.cmake
@@ -0,0 +1,9 @@
+
+enable_language(C)
+
+add_library(empty STATIC empty.c)
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT "[$<TARGET_PDB_FILE:empty>]"
+)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index c8f3fdf..6c32393 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -16,3 +16,10 @@ run_cmake(NonValidTarget-C_COMPILER_VERSION)
run_cmake(NonValidTarget-CXX_COMPILER_VERSION)
run_cmake(NonValidTarget-TARGET_PROPERTY)
run_cmake(NonValidTarget-TARGET_POLICY)
+
+if(LINKER_SUPPORTS_PDB)
+ run_cmake(NonValidTarget-TARGET_PDB_FILE)
+ run_cmake(ValidTarget-TARGET_PDB_FILE)
+else()
+ run_cmake(NonValidCompiler-TARGET_PDB_FILE)
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
new file mode 100644
index 0000000..748d14f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
@@ -0,0 +1,17 @@
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT)
+
+list(GET TEST_TXT 0 PDB_PATH)
+list(GET TEST_TXT 1 PDB_NAME)
+list(GET TEST_TXT 2 PDB_DIR)
+
+if(NOT PDB_PATH MATCHES "empty\\.pdb")
+ message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]")
+endif()
+
+if(NOT PDB_NAME STREQUAL "empty.pdb")
+ message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]")
+endif()
+
+if(PDB_DIR MATCHES "empty\\.pdb")
+ message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake
new file mode 100644
index 0000000..38e47f9
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE.cmake
@@ -0,0 +1,19 @@
+
+enable_language(C)
+
+add_library(empty SHARED empty.c)
+
+if(CMAKE_CONFIGURATION_TYPES)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG)
+ set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>)
+endif()
+
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt"
+ CONTENT
+[[$<TARGET_PDB_FILE:empty>
+$<TARGET_PDB_FILE_NAME:empty>
+$<TARGET_PDB_FILE_DIR:empty>
+]]
+ ${GENERATE_CONDITION}
+)