summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorYuchen Deng <loaden@gmail.com>2012-09-25 01:30:42 (GMT)
committerBrad King <brad.king@kitware.com>2012-09-25 19:23:35 (GMT)
commit3f60dbf1484575f4c28a15c89e1af071648c8f2d (patch)
tree2ff89c5574c9515a4f1a61d210dfbcc7b020af56 /Tests
parentd550801a3df96b991caf918435025aa233130bb4 (diff)
downloadCMake-3f60dbf1484575f4c28a15c89e1af071648c8f2d.zip
CMake-3f60dbf1484575f4c28a15c89e1af071648c8f2d.tar.gz
CMake-3f60dbf1484575f4c28a15c89e1af071648c8f2d.tar.bz2
Add PDB_OUTPUT_DIRECTORY and PDB_NAME target properties (#10830)
This enables changing the name and output folder of the debug symbol files produced by MS compilers. Inspired-by: Thomas Bernard <thomas.bernard@ipetronik.com>
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/PDBDirectoryAndName/CMakeLists.txt43
-rw-r--r--Tests/PDBDirectoryAndName/myexe.c5
-rw-r--r--Tests/PDBDirectoryAndName/myexe2.c3
-rw-r--r--Tests/PDBDirectoryAndName/mylibA.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibB.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibC.c1
-rw-r--r--Tests/PDBDirectoryAndName/mylibD.c1
8 files changed, 56 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index e03b926..4d071cb 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1259,6 +1259,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(CMAKE_TEST_MSVC OR
"${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles")
ADD_TEST_MACRO(ModuleDefinition example_exe)
+ ADD_TEST_MACRO(PDBDirectoryAndName myexe)
endif()
ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables)
diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt
new file mode 100644
index 0000000..ef1cae1
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 2.8)
+project(PDBDirectoryAndName C)
+
+if(NOT MSVC)
+ MESSAGE(FATAL_ERROR "The PDB file test works only with MSVC")
+endif()
+
+add_library(mylibA SHARED mylibA.c)
+set_target_properties(mylibA PROPERTIES
+ PDB_NAME "mylibA_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibA_PDB"
+)
+
+add_library(mylibB STATIC mylibB.c)
+set_target_properties(mylibB PROPERTIES
+ PDB_NAME "mylibB_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB"
+)
+
+add_library(mylibC SHARED mylibC.c)
+set_target_properties(mylibC PROPERTIES
+ PDB_NAME "mylibC_Special"
+)
+
+add_library(mylibD STATIC mylibD.c)
+set_target_properties(mylibD PROPERTIES
+ PDB_NAME "mylibD_Special"
+)
+
+add_executable(myexe myexe.c)
+set_target_properties(myexe PROPERTIES
+ PDB_NAME "myexe_Special"
+ PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/myexe_PDB"
+)
+
+target_link_libraries(myexe mylibA mylibB mylibC mylibD)
+
+add_executable(myexe2 myexe2.c)
+set_target_properties(myexe2 PROPERTIES
+ PDB_NAME "myexe2_Special"
+)
+
+target_link_libraries(myexe2 mylibA mylibD)
diff --git a/Tests/PDBDirectoryAndName/myexe.c b/Tests/PDBDirectoryAndName/myexe.c
new file mode 100644
index 0000000..c6d9065
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/myexe.c
@@ -0,0 +1,5 @@
+extern int mylibA();
+extern int mylibB();
+extern int mylibC();
+extern int mylibD();
+int main() { return mylibA() + mylibB() + mylibC() + mylibD(); }
diff --git a/Tests/PDBDirectoryAndName/myexe2.c b/Tests/PDBDirectoryAndName/myexe2.c
new file mode 100644
index 0000000..75b39cd
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/myexe2.c
@@ -0,0 +1,3 @@
+extern int mylibA();
+extern int mylibD();
+int main() { return mylibA() + mylibD(); }
diff --git a/Tests/PDBDirectoryAndName/mylibA.c b/Tests/PDBDirectoryAndName/mylibA.c
new file mode 100644
index 0000000..f4c553f
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibA.c
@@ -0,0 +1 @@
+__declspec(dllexport) int mylibA() { return 1; }
diff --git a/Tests/PDBDirectoryAndName/mylibB.c b/Tests/PDBDirectoryAndName/mylibB.c
new file mode 100644
index 0000000..2040c67
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibB.c
@@ -0,0 +1 @@
+int mylibB() { return -1; }
diff --git a/Tests/PDBDirectoryAndName/mylibC.c b/Tests/PDBDirectoryAndName/mylibC.c
new file mode 100644
index 0000000..adf7c70
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibC.c
@@ -0,0 +1 @@
+__declspec(dllexport) int mylibC() { return 1; }
diff --git a/Tests/PDBDirectoryAndName/mylibD.c b/Tests/PDBDirectoryAndName/mylibD.c
new file mode 100644
index 0000000..efa8a82
--- /dev/null
+++ b/Tests/PDBDirectoryAndName/mylibD.c
@@ -0,0 +1 @@
+int mylibD() { return -1; }