summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-11-11 19:04:29 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-11-11 19:04:29 (GMT)
commit5ac4801a04fe7ff0c2687673a194828d6f98827e (patch)
tree7633ba2ab3942b48bd5758a8ada5c506ddd83d81
parent6d932c627ba0c7df71c7c81de75974944a3a347d (diff)
downloadCMake-5ac4801a04fe7ff0c2687673a194828d6f98827e.zip
CMake-5ac4801a04fe7ff0c2687673a194828d6f98827e.tar.gz
CMake-5ac4801a04fe7ff0c2687673a194828d6f98827e.tar.bz2
BUG: use different commands for shared libraries and exe for manifest stuff fix for bug#4039
-rw-r--r--Modules/CMakeVCManifestExe.cmake30
-rw-r--r--Modules/Platform/Windows-cl.cmake4
2 files changed, 32 insertions, 2 deletions
diff --git a/Modules/CMakeVCManifestExe.cmake b/Modules/CMakeVCManifestExe.cmake
new file mode 100644
index 0000000..5066bc8
--- /dev/null
+++ b/Modules/CMakeVCManifestExe.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}\;\#1 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};#1\""
+ )
+ ENDIF(NOT "${RESULT}" MATCHES "^0$")
+ENDIF(EXISTS "${TARGET}.manifest")
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 361dbbc..a2338ef 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -218,10 +218,10 @@ IF(MSVC80)
# create a C shared module just copy the shared library rule
SET(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_LIBRARY}")
SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}"
- "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifestExe.cmake\""
)
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}"
- "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifestExe.cmake\""
)
SET(CMAKE_BUILD_TYPE_INIT Debug)