Merge topic 'fix-ms-manifest-no-linker'

ca263d1d MSVC: Fix linking with /MANIFEST:NO option
This commit is contained in:
Brad King 2015-11-19 09:10:23 -05:00 committed by CMake Topic Stage
commit 65b9d1f228
2 changed files with 5 additions and 1 deletions

View File

@ -1555,7 +1555,6 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
// pass it to the link command. // pass it to the link command.
this->ManifestFileRC = intDir + "/manifest.rc"; this->ManifestFileRC = intDir + "/manifest.rc";
this->ManifestFileRes = intDir + "/manifest.res"; this->ManifestFileRes = intDir + "/manifest.res";
this->LinkCommand.push_back(this->ManifestFileRes);
} }
else if (this->UserManifests.empty()) else if (this->UserManifests.empty())
{ {
@ -1663,6 +1662,9 @@ int cmVSLink::LinkIncremental()
return -1; return -1;
} }
// Tell the linker to use our manifest compiled into a resource.
this->LinkCommand.push_back(this->ManifestFileRes);
// Run the link command (possibly generates intermediate manifest). // Run the link command (possibly generates intermediate manifest).
if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose)) if (!RunCommand("LINK Pass 1", this->LinkCommand, this->Verbose))
{ {

View File

@ -6,4 +6,6 @@ if(MSVC AND NOT MSVC_VERSION LESS 1400)
COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest> COMMAND ${CMAKE_COMMAND} -Dexe=$<TARGET_FILE:MSManifest>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
) )
add_executable(MSManifestNone main.c)
set_property(TARGET MSManifestNone PROPERTY LINK_FLAGS "/MANIFEST:NO")
endif() endif()