From b4a8d11cfbd0c730be128cb43c7eb48a5bb4a3df Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 16 Aug 2016 12:59:52 +0100 Subject: [PATCH] Optionally use fixed osgDB build for linking This allows us to drop the /FORCE:MULTIPLE work-around. --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 673976b5d..7d482a87c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,10 @@ option(ENABLE_FGCOM "Set to ON to build the FGCom application (default)" ON option(ENABLE_FLITE "Set to ON to build the Flite text-to-speech module" ON) option(ENABLE_QT "Set to ON to build the internal Qt launcher" ON) +# when building an OSG with commit 15ec7e2ae7a8b983ecc44e1ce7363a9a9fa7da95 +# applied, we can use better link options +option(OSG_FSTREAM_EXPORT_FIXED "Set to ON if the osgDB fstream export patch is applied" OFF) + if(LOGGING) # nothing else() @@ -361,9 +365,12 @@ if(WIN32) if(MSVC) set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP") - if (${MSVC_VERSION} GREATER 1599) - set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" ) - endif (${MSVC_VERSION} GREATER 1599) + if (NOT OSG_FSTREAM_EXPORT_FIXED AND ${MSVC_VERSION} GREATER 1599) + message(STATUS "For better linking performance, use OSG with fixed fstream header") + # needed to avoid link errors on multiply-defined standard C++ + # symbols. This issue was fixed in OSG commit 15ec7e2ae7a8b983ecc44e1ce7363a9a9fa7da95 + set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" ) + endif () if (${MSVC_VERSION} GREATER 1899) # needed for debug builds with VS2015 -- 2.39.5