Changed: Allow to use static C++ runtimes

--HG--
branch : develop
This commit is contained in:
kervala 2018-07-10 20:42:37 +02:00
parent 4444e93bf7
commit f3753a08a8

View file

@ -238,6 +238,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(WITH_EXTERNAL "With provided external." OFF) OPTION(WITH_EXTERNAL "With provided external." OFF)
ENDIF() ENDIF()
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
OPTION(WITH_STATIC_RUNTIMES "Use only static C++ runtimes" OFF)
IF(UNIX AND NOT APPLE) IF(UNIX AND NOT APPLE)
OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON ) OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON )
ELSE() ELSE()
@ -636,8 +637,14 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
ENDIF() ENDIF()
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") IF(WITH_STATIC_RUNTIMES)
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") SET(RUNTIME_FLAG "/MT")
ELSE()
SET(RUNTIME_FLAG "/MD")
ENDIF()
SET(NL_DEBUG_CFLAGS "/Zi ${RUNTIME_FLAG}d /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "${RUNTIME_FLAG} /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}")
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}") SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}")
@ -967,6 +974,10 @@ MACRO(NL_SETUP_BUILD)
IF(NOT APPLE) IF(NOT APPLE)
ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed")
IF(WITH_STATIC_RUNTIMES)
ADD_PLATFORM_LINKFLAGS("-static-libstdc++")
ENDIF()
ENDIF() ENDIF()
IF(NOT APPLE) IF(NOT APPLE)