Browse Source

Fixed missing check for unset CMAKE_BUILD_TYPE

Eyck Jentzsch 1 year ago
parent
commit
bd60e4dbe1
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      CMakeLists.txt

+ 6
- 2
CMakeLists.txt View File

@@ -26,8 +26,12 @@ set(CMAKE_CXX_EXTENSIONS OFF)
26 26
 	
27 27
 include(CheckCXXCompilerFlag)
28 28
 CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
29
-if(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") AND COMPILER_SUPPORTS_MARCH_NATIVE)
29
+if(COMPILER_SUPPORTS_MARCH_NATIVE)
30
+if("${CMAKE_BUILD_TYPE}" STREQUAL "") 
30 31
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
32
+elseif(NOT(${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
33
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
34
+endif()
31 35
 endif()
32 36
 
33 37
 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
55 59
 add_subdirectory(riscv)
56 60
 add_subdirectory(riscv.sc)
57 61
 
58
-message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
62
+message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")