From c8f1e52587ddd22cc421beb87fda4304a67d1455 Mon Sep 17 00:00:00 2001 From: etenie Date: Sun, 10 Nov 2024 21:39:27 +0100 Subject: [PATCH] Make the builds optimalized --- CMakeLists.txt | 7 ++++++- README.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d4a2fa..35b5fcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,12 @@ project(nutri) set(CMAKE_CXX_STANDARD 26) set(CMAKE_EXPORT_COMPILE_COMMANDS 1) -set(CMAKE_CXX_FLAGS -fdiagnostics-color=always) +add_compile_options(-fdiagnostics-color=always) + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + add_compile_options(-O3 -march=native) +endif() include(FetchContent) diff --git a/README.md b/README.md index 492ff95..f9d1a36 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ cd nutri ### Build with CMake ```bash -cmake -S . -B build +cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build ```