Fix C++11 building on MSVC 2015
[blender.git] / CMakeLists.txt
index 64fd2c569ee48cee8cc6a26696ca9e87143a6b6a..a7f1c00c850626fb8497694059ade3fc5e7e028c 100644 (file)
@@ -333,7 +333,7 @@ option(WITH_ALEMBIC             "Enable Alembic Support" OFF)
 option(WITH_ALEMBIC_HDF5        "Enable Legacy Alembic Support (not officially supported)" OFF)
 
 if(APPLE)
-       option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" ON)
+       option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
 endif()
 
 # 3D format support
@@ -343,9 +343,9 @@ option(WITH_OPENCOLLADA   "Enable OpenCollada Support (http://www.opencollada.or
 # Sound output
 option(WITH_SDL           "Enable SDL for sound and joystick support" ${_init_SDL})
 option(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
-option(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" ${_init_JACK})
+option(WITH_JACK          "Enable JACK Support (http://www.jackaudio.org)" ${_init_JACK})
 if(UNIX AND NOT APPLE)
-       option(WITH_JACK_DYNLOAD  "Enable runtime dynamic Jack libraries loading" OFF)
+       option(WITH_JACK_DYNLOAD  "Enable runtime dynamic JACK libraries loading" OFF)
 endif()
 if(UNIX AND NOT APPLE)
        option(WITH_SDL_DYNLOAD  "Enable runtime dynamic SDL libraries loading" OFF)
@@ -497,17 +497,22 @@ endif()
 # We default options to whatever default standard in the current compiler.
 if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
        set(_c11_init ON)
-       set(_cxx11_init ON)
 else()
        set(_c11_init OFF)
-       set(_cxx11_init OFF)
 endif()
+set(_cxx11_init ON)
 
 option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
 mark_as_advanced(WITH_C11)
 option(WITH_CXX11 "Build with C++11 standard enabled, for development use only!" ${_cxx11_init})
 mark_as_advanced(WITH_CXX11)
 
+# Compiler toolchain
+if(CMAKE_COMPILER_IS_GNUCC)
+       option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
+       mark_as_advanced(WITH_LINKER_GOLD)
+endif()
+
 # Dependency graph
 option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
 mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
@@ -731,7 +736,7 @@ elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL O
        # Keep enabled
 else()
        # New dependency graph needs either Boost or C++11 for function bindings.
-       if(NOT USE_CXX11)
+       if(NOT WITH_CXX11)
                # Enabled but we don't need it
                set(WITH_BOOST OFF)
        endif()
@@ -986,7 +991,7 @@ if(SUPPORT_SSE_BUILD)
        add_definitions(-D__SSE__ -D__MMX__)
 endif()
 if(SUPPORT_SSE2_BUILD)
-       set(PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG} ${PLATFORM_CFLAGS}")
+       set(PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}")
        add_definitions(-D__SSE2__)
        if(NOT SUPPORT_SSE_BUILD) # dont double up
                add_definitions(-D__MMX__)
@@ -1561,7 +1566,7 @@ if(WITH_CXX11)
        if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
                # TODO(sergey): Do we want c++11 or gnu-c++11 here?
                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-       elseif(MSVC12)
+       elseif(MSVC14 OR MSVC12)
                # Nothing special is needed, C++11 features are available by default.
        else()
                message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")