summaryrefslogtreecommitdiff
path: root/cmake/InstallPDB.cmake
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2014-10-02 15:48:35 +0100
committerJosé Fonseca <jfonseca@vmware.com>2014-10-02 15:48:35 +0100
commit01e5c8561150f4f797d23b2df76edecf9efd8f51 (patch)
tree68991f89903f9807db3a1ba33e33e01e2960fb7e /cmake/InstallPDB.cmake
parent61c46938b7bb95de0dbd0b90cd76c84509d61307 (diff)
cmake: Package/install .PDB files too.
Diffstat (limited to 'cmake/InstallPDB.cmake')
-rw-r--r--cmake/InstallPDB.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/InstallPDB.cmake b/cmake/InstallPDB.cmake
new file mode 100644
index 00000000..d7ed7618
--- /dev/null
+++ b/cmake/InstallPDB.cmake
@@ -0,0 +1,17 @@
+function (INSTALL_PDB target_name)
+ if (MSVC)
+ get_target_property (target_output_name ${target_name} OUTPUT_NAME)
+ if (NOT target_output_name)
+ set (target_output_name ${target_name})
+ endif ()
+
+ # The documentation for the INSTALL command doesn't mention generator
+ # expressions, but they actually work quite well, both when building
+ # MSBuild and Ninja.
+ install (
+ FILES "$<TARGET_FILE_DIR:${target_name}>/${target_output_name}.pdb"
+ CONFIGURATIONS Debug RelWithDebInfo
+ ${ARGV}
+ )
+ endif()
+endfunction ()