MantisBT - CMake
View Issue Details
0012881CMakeCMakepublic2012-01-18 08:512016-06-10 14:31
Daniel Lehtovirta 
Kitware Robot 
normalmajoralways
closedmoved 
Apple MacOS X10.4.10
CMake 2.8.7 
 
0012881: \DYNAMICBASE and \NXCOMPAT don't work on Visual Studio 8 2005 builds
Creating vcproj file for Visual Studio 8 2005. When adding linker flags \DYNAMICBASE and \NXCOMPAT

For instance by having this in the CMakeLists.txt file:
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NXCOMPAT /DYNAMICBASE")

CMake is translating this to, DataExecutionPrevention="2" and RandomizedBaseAddress="2" something that Visual Studio 8 2005 don't understand and being ignored by the linker.

If I manually add \DYNAMICBASE and \NXCOMPAT to the AdditionalOptions parameter it works fine.
1. Add
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NXCOMPAT /DYNAMICBASE")
to the CMakeLists.txt in your project, make the vcproj file for Visual Studio 8 2005.
2. Check the vcproj file and noticed the DataExecutionPrevention="2" and RandomizedBaseAddress="2".
3. Build the file and see that the dll don't have these options sent to the linker.
No tags attached.
Issue History
2012-01-18 08:51Daniel LehtovirtaNew Issue
2012-01-18 14:14Brad KingNote Added: 0028355
2012-02-02 14:05Brad KingNote Added: 0028451
2012-02-02 14:05Brad KingStatusnew => backlog
2016-06-10 14:28Kitware RobotNote Added: 0041967
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0028355)
Brad King   
2012-01-18 14:14   
The mappings for these flags to the IDE project file attributes were added in CMake 2.8.5:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85163fba [^]

but apparently some are not understood by VS older than 2008.
(0028451)
Brad King   
2012-02-02 14:05   
Solving this will require the VS flag tables that map flags to IDE options:

http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalVisualStudio7Generator.cxx;hb=v2.8.7#l399 [^]
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalVisualStudio7Generator.cxx;hb=v2.8.7#l504 [^]

to be refactored such that they are populated based on the target IDE version.
(0041967)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.