diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 15f5b50dce14adbbb3f62c594959f3c3075e2155..7a54785a4e343c657876f3397b2d251a55be4a03 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -36,7 +36,11 @@ IF(COMPILER_IS_GCC) # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33144 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mtune=native -msse4.2 -DNDEBUG") ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -mtune=native -msse4.2 -DNDEBUG") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -mtune=native -msse4.2 -DNDEBUG") + # Disable -march=native on Ninja generator + IF(NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") + ENDIF() ENDIF() ENDIF() # -g diff --git a/scripts/cmake/cmake/SetDefaultBuildType.cmake b/scripts/cmake/cmake/SetDefaultBuildType.cmake index cd29e32ac23866e6fa40439bd8df3ae001e6c4d9..d7e6d987a04c86360638935b801e1a087cd1f90c 100644 --- a/scripts/cmake/cmake/SetDefaultBuildType.cmake +++ b/scripts/cmake/cmake/SetDefaultBuildType.cmake @@ -22,7 +22,7 @@ set(__set_default_build_type YES) function(set_default_build_type _type) #if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) - if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE) + if(("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_GENERATOR}" MATCHES "Ninja") AND NOT CMAKE_BUILD_TYPE) if(NOT __DEFAULT_BUILD_TYPE_SET) set(CMAKE_BUILD_TYPE "${_type}" CACHE STRING "" FORCE) set(__DEFAULT_BUILD_TYPE_SET YES CACHE INTERNAL "")