Universally use add_compile_options().

This commit is contained in:
Bartosz Taudul 2024-09-27 14:10:30 +02:00
parent be53a82e78
commit 0e47224578
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 5 additions and 10 deletions

View File

@ -3,19 +3,16 @@ if (NOT NO_ISA_EXTENSIONS)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
CHECK_CXX_COMPILER_FLAG("-mcpu=native" COMPILER_SUPPORTS_MCPU_NATIVE) CHECK_CXX_COMPILER_FLAG("-mcpu=native" COMPILER_SUPPORTS_MCPU_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE) if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native") add_compile_options(-mcpu=native)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=native")
endif() endif()
else() else()
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE) if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") add_compile_options(-march=native)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
endif() endif()
endif() endif()
if(WIN32) if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") add_compile_options(/arch:AVX2)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2")
endif() endif()
endif() endif()
@ -48,8 +45,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT EMSCRIPTEN)
set(CMAKE_LINKER_TYPE "MOLD") set(CMAKE_LINKER_TYPE "MOLD")
endif() endif()
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-eliminate-unused-debug-types") add_compile_options(-fno-eliminate-unused-debug-types)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-eliminate-unused-debug-types")
endif() endif()
endif() endif()

View File

@ -160,8 +160,7 @@ link_libraries(${LIBS})
if(SELF_PROFILE) if(SELF_PROFILE)
add_definitions(-DTRACY_ENABLE) add_definitions(-DTRACY_ENABLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -fno-omit-frame-pointer") add_compile_options(-g -O3 -fno-omit-frame-pointer)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -fno-omit-frame-pointer")
set(PROFILER_FILES ${PROFILER_FILES} set(PROFILER_FILES ${PROFILER_FILES}
../public/TracyClient.cpp ../public/TracyClient.cpp
) )