Fixed missing check for unset CMAKE_BUILD_TYPE

This commit is contained in:
Eyck Jentzsch 2018-07-10 18:25:14 +02:00
parent 282ff6964b
commit bd60e4dbe1
1 changed files with 6 additions and 2 deletions

View File

@ -26,8 +26,12 @@ set(CMAKE_CXX_EXTENSIONS OFF)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") AND COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -55,4 +59,4 @@ GET_DIRECTORY_PROPERTY(SOFTFLOAT_INCLUDE_DIRS DIRECTORY softfloat DEFINITION SOF
add_subdirectory(riscv)
add_subdirectory(riscv.sc)
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")