summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorJustin Goshi <jgoshi@microsoft.com>2017-10-25 20:02:32 (GMT)
committerBrad King <brad.king@kitware.com>2017-10-31 14:02:25 (GMT)
commit5b9da05b7acc27ce40d27afcda0029284a0a4590 (patch)
treefe9f8a6d796128c20fef9139ee5f04edc4dde2d5 /Source/CMakeLists.txt
parent206354ac4c2b0e245cc02f3c9f8b82990f829ee8 (diff)
downloadCMake-5b9da05b7acc27ce40d27afcda0029284a0a4590.zip
CMake-5b9da05b7acc27ce40d27afcda0029284a0a4590.tar.gz
CMake-5b9da05b7acc27ce40d27afcda0029284a0a4590.tar.bz2
Windows: Embed version information into CMake binaries
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e1c34bf..f15dff8 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -1057,6 +1057,19 @@ endif()
include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
+if(WIN32)
+ # Add Windows executable version information.
+ configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY)
+
+ # We use a separate object library for this to work around a limitation of
+ # MinGW's windres tool with spaces in the path to the include directories.
+ add_library(CMakeVersion OBJECT "${CMAKE_CURRENT_BINARY_DIR}/CMakeVersion.rc")
+ set_property(TARGET CMakeVersion PROPERTY INCLUDE_DIRECTORIES "")
+ foreach(_tool ${_tools})
+ target_sources(${_tool} PRIVATE $<TARGET_OBJECTS:CMakeVersion>)
+ endforeach()
+endif()
+
# Install tools
foreach(_tool ${_tools})