CMake: De-duplicate checks around unordered maps and shared pointer
[blender.git] / CMakeLists.txt
index 193ac4872287ed6fe2a1807c0d70fad0ad6259f9..e91f4b503a23b51d88eac6c001c41c4d4239e23f 100644 (file)
@@ -399,6 +399,9 @@ mark_as_advanced(WITH_CYCLES_LOGGING)
 mark_as_advanced(WITH_CYCLES_DEBUG)
 mark_as_advanced(WITH_CYCLES_WERROR)
 
+option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
+mark_as_advanced(WITH_CUDA_DYNLOAD)
+
 # LLVM
 option(WITH_LLVM                                       "Use LLVM" OFF)
 if(APPLE)
@@ -728,6 +731,9 @@ if(HAVE_STDBOOL_H)
        add_definitions(-DHAVE_STDBOOL_H)
 endif()
 
+TEST_SHARED_PTR_SUPPORT()
+TEST_UNORDERED_MAP_SUPPORT()
+
 if(WITH_AUDASPACE)
        if(WITH_SYSTEM_AUDASPACE)
                set(AUDASPACE_DEFINITIONS
@@ -2469,7 +2475,7 @@ if(WITH_OPENMP)
                        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
                else()
                        # Typically avoid adding flags as defines but we can't
-                       # ass OpenMP flags to the linker for static builds, meaning
+                       # pass OpenMP flags to the linker for static builds, meaning
                        # we can't add any OpenMP related flags to CFLAGS variables
                        # since they're passed to the linker as well.
                        add_definitions("${OpenMP_C_FLAGS}")
@@ -2601,7 +2607,6 @@ endif()
 if(WITH_LIBMV)
        set(CERES_DEFINES)
 
-       TEST_SHARED_PTR_SUPPORT()
        if(SHARED_PTR_FOUND)
                if(SHARED_PTR_TR1_MEMORY_HEADER)
                        list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
@@ -2613,7 +2618,6 @@ if(WITH_LIBMV)
                message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
        endif()
 
-       TEST_UNORDERED_MAP_SUPPORT()
        if(HAVE_STD_UNORDERED_MAP_HEADER)
                if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
                        list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
@@ -2906,7 +2910,9 @@ if(WITH_BLENDER OR WITH_PLAYER)
 elseif(WITH_CYCLES_STANDALONE)
        add_subdirectory(intern/cycles)
        add_subdirectory(extern/clew)
-       add_subdirectory(extern/cuew)
+       if(WITH_CUDA_DYNLOAD)
+               add_subdirectory(extern/cuew)
+       endif()
        if(NOT WITH_SYSTEM_GLEW)
                add_subdirectory(extern/glew)
        endif()