diff options
author | Brad King <brad.king@kitware.com> | 2006-08-15 19:33:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-08-15 19:33:20 (GMT) |
commit | 276e7e21a3bfa862ca5f966fbba5ed6390fcf1ae (patch) | |
tree | f9adf49465599e7cabf349cb0c9ff3da571f1dbe /Modules/CMakeVCManifest.cmake | |
parent | c7daee686003768aa58651e7d7ee31beac4d35f9 (diff) | |
download | CMake-276e7e21a3bfa862ca5f966fbba5ed6390fcf1ae.zip CMake-276e7e21a3bfa862ca5f966fbba5ed6390fcf1ae.tar.gz CMake-276e7e21a3bfa862ca5f966fbba5ed6390fcf1ae.tar.bz2 |
ENH: Adding flags to force generation of manifest files when building with VC 8.
Diffstat (limited to 'Modules/CMakeVCManifest.cmake')
-rw-r--r-- | Modules/CMakeVCManifest.cmake | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Modules/CMakeVCManifest.cmake b/Modules/CMakeVCManifest.cmake new file mode 100644 index 0000000..6675f99 --- /dev/null +++ b/Modules/CMakeVCManifest.cmake @@ -0,0 +1,30 @@ + +# Leave the first line of this file empty so this module will not be +# included in the documentation. + +# This script is invoked from Windows-cl.cmake and passed the TARGET +# variable on the command line. + +# Conditionally embed the manifest in the executable if it exists. +IF(EXISTS "${TARGET}.manifest") + # Construct the manifest embedding command. + SET(CMD + mt ${CMAKE_CL_NOLOGO} /manifest ${TARGET}.manifest + /outputresource:${TARGET} + ) + + # Run the embedding command. + EXECUTE_PROCESS(COMMAND ${CMD}\;\#2 RESULT_VARIABLE RESULT) + + # Check whether the command failed. + IF(NOT "${RESULT}" MATCHES "^0$") + # The embedding failed remove the target and the manifest. + FILE(REMOVE ${TARGET} ${TARGET}.manifest) + + # Describe the failure in a message. + STRING(REGEX REPLACE ";" " " CMD "${CMD}") + MESSAGE(FATAL_ERROR + "Failed to embed manifest in ${TARGET} using command \"${CMD};#2\"" + ) + ENDIF(NOT "${RESULT}" MATCHES "^0$") +ENDIF(EXISTS "${TARGET}.manifest") |