summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-15 19:33:20 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-15 19:33:20 (GMT)
commit276e7e21a3bfa862ca5f966fbba5ed6390fcf1ae (patch)
treef9adf49465599e7cabf349cb0c9ff3da571f1dbe /Modules
parentc7daee686003768aa58651e7d7ee31beac4d35f9 (diff)
downloadCMake-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')
-rw-r--r--Modules/CMakeVCManifest.cmake30
-rw-r--r--Modules/Platform/Windows-cl.cmake19
2 files changed, 43 insertions, 6 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")
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 9a99652..d5c1976 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -209,17 +209,21 @@ ENDIF(CMAKE_FORCE_WIN64)
# default to Debug builds
IF(MSVC80)
# for 2005 make sure the manifest is put in the dll with mt
- SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}"
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
SET(CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# 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}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
SET(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}"
- "mt ${CMAKE_CL_NOLOGO} /manifest <TARGET>.manifest /outputresource:<TARGET>\;#2")
+ "$(CMAKE_COMMAND) -DTARGET=<TARGET> -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\""
+ )
+
SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
@@ -232,6 +236,7 @@ IF(MSVC80)
SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST")
ELSE(MSVC80)
IF(CMAKE_USING_VC_FREE_TOOLS)
MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available")
@@ -269,9 +274,11 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the stack size and the machine type
IF(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:x64")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64")
ELSE(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /machine:I386")
+ SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386")
ENDIF(CMAKE_CL_64)
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp