From 21353ef51dec4fd7784dc1b129036370c3bac98f Mon Sep 17 00:00:00 2001 From: Dominik Wernberger Date: Sat, 29 Jun 2024 13:07:03 +0200 Subject: [PATCH] Add compiler specific build flags --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d576aea..692e475 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,12 +12,19 @@ endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra") +add_compile_options($<$:-Wall>) +add_compile_options($<$:-Werror>) +add_compile_options($<$:-Wextra>) + +# @todo enable /WX +add_compile_options($<$:/Wall>) if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") + add_compile_options($<$:-g3>) else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -flto") + add_compile_options($<$:-O3>) + add_compile_options($<$:-flto>) + add_compile_options($<$:/O2>) endif() # Add fmt dependency