Skip to content

Commit 8f8a568

Browse files
committed
CMakeLists.txt: LTCG, compiler flags fixed
1 parent 5d0243f commit 8f8a568

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required(VERSION 3.15) # Has to be 3.15+ because of this: https://cmake.org/cmake/help/latest/policy/CMP0057.html
22
project(cpputils LANGUAGES CXX)
33

4+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
5+
46
file(GLOB_RECURSE SOURCES
57
"debugger/*.cpp"
68
"math/*.cpp"
@@ -22,6 +24,9 @@ file(GLOB_RECURSE HEADERS
2224
"utility_functions/*.h*"
2325
)
2426

27+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
28+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "")
29+
2530
# Set the library as static
2631
add_library(cpputils STATIC ${SOURCES} ${HEADERS})
2732

@@ -48,15 +53,16 @@ target_include_directories(cpputils PUBLIC
4853
if(MSVC)
4954
# Visual Studio specific flags
5055
target_compile_options(cpputils PRIVATE
51-
"$<$<CONFIG:Debug>:/JMC>"
56+
$<$<CONFIG:Debug>:/JMC>
57+
$<$<CONFIG:RelWithDebInfo>:/GS- /O2>
5258
/MP /Zi
5359
/std:c++latest /permissive- /Zc:__cplusplus /Zc:char8_t
54-
/W4 /FS
60+
/W4 /FS /Gy
5561
)
5662
target_link_options(cpputils PRIVATE
57-
"$<$<CONFIG:Release>:/OPT:REF /OPT:ICF>"
58-
"$<$<CONFIG:Debug>:/INCREMENTAL>"
59-
"/DEBUG:FASTLINK"
63+
$<$<CONFIG:RelWithDebInfo>:/OPT:REF /OPT:ICF>
64+
$<$<CONFIG:Debug>:/INCREMENTAL>
65+
/DEBUG:FASTLINK
6066
)
6167
target_compile_definitions(cpputils PRIVATE
6268
WIN32_LEAN_AND_MEAN
@@ -77,6 +83,7 @@ else()
7783
-Wshadow -Wstrict-aliasing -Wstrict-aliasing=3 -Wuninitialized
7884
-Wunused-const-variable=2 -Wwrite-strings -Wlogical-op
7985
-Wno-missing-include-dirs -Wno-undef
86+
$<$<CONFIG:RelWithDebInfo>:-O3>
8087
)
8188
target_link_options(cpputils PRIVATE -fuse-ld=gold)
8289

0 commit comments

Comments
 (0)