From Jean-Sebastien Guay, "As I discussed in the thread "Windows 7 beta: "The binary is not a valid Windows image."" on osg-users, I needed to add the /DYNAMICBASE linker option for executables to link properly in release mode on Windows 7 beta.
http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/42400 Since this is a workaround for a bug in a beta OS (which may or may not be fixed, since it's mentioned in their release notes so they may just leave it as it is) I've marked the option as advanced, default to OFF, and clearly documented it as being useful for Windows 7 only. I'd like to be able to test for Windows 7 directly instead of the blanket IF(WIN32), but I can't figure out if this is possible in CMake. Here's the modified CMakeLists.txt. It's a small change, with low impact, but will be useful to others who test out this OS and when it comes out. Note that I'm not familiar with this option in general, and didn't get any feedback to my questions in the above-mentioned thread, one of which was: Could we just add this option to all builds? What is the impact? That's still unclear to me, but without it OSG executables don't build, and the article I linked didn't seem to present any ill effects to enabling the option."
This commit is contained in:
parent
ee4e2afa76
commit
53a19190ce
@ -184,6 +184,15 @@ IF(WIN32)
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
|
||||
# endforeach(warning)
|
||||
|
||||
# This option is to enable the /DYNAMICBASE switch
|
||||
# It is used to workaround a bug in Windows 7 when linking in release, which results in corrupt
|
||||
# binaries. See this page for details: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/01/24/the-case-of-the-corrupt-pe-binaries.aspx
|
||||
OPTION(WIN32_USE_DYNAMICBASE "Set to ON to build OpenSceneGraph with the /DYNAMICBASE option to work around a bug when linking release executables on Windows 7." OFF)
|
||||
MARK_AS_ADVANCED(WIN32_USE_DYNAMICBASE)
|
||||
IF(WIN32_USE_DYNAMICBASE)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE")
|
||||
ENDIF(WIN32_USE_DYNAMICBASE)
|
||||
|
||||
# More MSVC specific compilation flags
|
||||
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
|
Loading…
Reference in New Issue
Block a user