Add CMake option to use /MD runtime (#7277)
This commit is contained in:
parent
b2d8431aea
commit
2a0368b7ca
@ -28,6 +28,7 @@ set_default_configuration_release()
|
|||||||
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
|
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
|
||||||
option(USE_OPENMP "Build with OpenMP support." ON)
|
option(USE_OPENMP "Build with OpenMP support." ON)
|
||||||
option(BUILD_STATIC_LIB "Build static library" OFF)
|
option(BUILD_STATIC_LIB "Build static library" OFF)
|
||||||
|
option(FORCE_SHARED_CRT "Build with dynamic CRT on Windows (/MD)" OFF)
|
||||||
option(RABIT_BUILD_MPI "Build MPI" OFF)
|
option(RABIT_BUILD_MPI "Build MPI" OFF)
|
||||||
## Bindings
|
## Bindings
|
||||||
option(JVM_BINDINGS "Build JVM bindings" OFF)
|
option(JVM_BINDINGS "Build JVM bindings" OFF)
|
||||||
@ -160,6 +161,9 @@ endif (USE_NCCL)
|
|||||||
|
|
||||||
# dmlc-core
|
# dmlc-core
|
||||||
msvc_use_static_runtime()
|
msvc_use_static_runtime()
|
||||||
|
if (FORCE_SHARED_CRT)
|
||||||
|
set(DMLC_FORCE_SHARED_CRT ON)
|
||||||
|
endif ()
|
||||||
add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core)
|
add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ endfunction(auto_source_group)
|
|||||||
|
|
||||||
# Force static runtime for MSVC
|
# Force static runtime for MSVC
|
||||||
function(msvc_use_static_runtime)
|
function(msvc_use_static_runtime)
|
||||||
if(MSVC)
|
if(MSVC AND (NOT BUILD_SHARED_LIBS) AND (NOT FORCE_SHARED_CRT))
|
||||||
set(variables
|
set(variables
|
||||||
CMAKE_C_FLAGS_DEBUG
|
CMAKE_C_FLAGS_DEBUG
|
||||||
CMAKE_C_FLAGS_MINSIZEREL
|
CMAKE_C_FLAGS_MINSIZEREL
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user