diff --git a/cmake/config.cmake b/cmake/config.cmake index 4370ad64..1367f9a5 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -3,19 +3,16 @@ if (NOT NO_ISA_EXTENSIONS) if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") CHECK_CXX_COMPILER_FLAG("-mcpu=native" COMPILER_SUPPORTS_MCPU_NATIVE) if(COMPILER_SUPPORTS_MARCH_NATIVE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=native") + add_compile_options(-mcpu=native) endif() else() CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) if(COMPILER_SUPPORTS_MARCH_NATIVE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") + add_compile_options(-march=native) endif() endif() if(WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2") + add_compile_options(/arch:AVX2) endif() endif() @@ -48,8 +45,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT EMSCRIPTEN) set(CMAKE_LINKER_TYPE "MOLD") endif() if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-eliminate-unused-debug-types") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-eliminate-unused-debug-types") + add_compile_options(-fno-eliminate-unused-debug-types) endif() endif() diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 3d8b5495..f1d4d631 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -160,8 +160,7 @@ link_libraries(${LIBS}) if(SELF_PROFILE) add_definitions(-DTRACY_ENABLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -fno-omit-frame-pointer") + add_compile_options(-g -O3 -fno-omit-frame-pointer) set(PROFILER_FILES ${PROFILER_FILES} ../public/TracyClient.cpp )