diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e47981d0db3..f43a592a6663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,12 +206,15 @@ else() if(SUPPORT_CXX14) add_definitions(-DDMLC_USE_CXX11=1) add_definitions(-DDMLC_USE_CXX14=1) + add_definitions(-DMSHADOW_IN_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") elseif(SUPPORT_CXX11) add_definitions(-DDMLC_USE_CXX11=1) + add_definitions(-DMSHADOW_IN_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(SUPPORT_CXX0X) add_definitions(-DDMLC_USE_CXX11=1) + add_definitions(-DMSHADOW_IN_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() endif(MSVC) @@ -674,13 +677,7 @@ if(USE_PLUGIN_CAFFE) endif() endif() -if(NOT MSVC) - # Only add c++11 flags and definitions after cuda compiling - add_definitions(-DDMLC_USE_CXX11) - add_definitions(-DMSHADOW_IN_CXX11) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -else() +if(MSVC) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /EHsc") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHsc /Gy") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /EHsc /Gy")