From a9399bfa9243c1498c7643d005b0caaafe65190c Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 13 May 2021 03:17:42 +0200 Subject: [PATCH] WIP O2 --- CMakeLists.txt | 2 ++ cmake.toml | 1 + cmake/O2.cmake | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 cmake/O2.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f15b70f..5d57b2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,8 @@ if(CMKR_ROOT_PROJECT) configure_file(cmake.toml cmake.toml COPYONLY) endif() +include("cmake/O2.cmake") + project(cmkr LANGUAGES CXX diff --git a/cmake.toml b/cmake.toml index bd8e0e8..e20e0c6 100644 --- a/cmake.toml +++ b/cmake.toml @@ -7,6 +7,7 @@ version = "0.1.4" description = "CMakeLists generator from TOML" languages = ["CXX"] subdirs = ["third_party", "tests"] +include-before = ["cmake/O2.cmake"] [target.cmkr] type = "executable" diff --git a/cmake/O2.cmake b/cmake/O2.cmake new file mode 100644 index 0000000..b1cc667 --- /dev/null +++ b/cmake/O2.cmake @@ -0,0 +1,6 @@ +# Modify compile flags to change optimization level from O3 to O2 +if(MSVC) + set(CMAKE_CXX_FLAGS_RELEASE "/Od /Ob2 /DNDEBUG") +else() + set(CMAKE_CXX_FLAGS_RELEASE "-O2") +endif() \ No newline at end of file