From 695094cd71869b8c3a7a61b614051a2ba7b514db Mon Sep 17 00:00:00 2001 From: Leonard Lausen Date: Wed, 22 Jan 2020 23:41:17 +0000 Subject: [PATCH] Simplify C++ flags "Only add c++11 flags and definitions after cuda compiling" is not true anymore --- CMakeLists.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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")