This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,29 @@ else()
45
45
message (STATUS "CORTEX_CQA is OFF." )
46
46
endif ()
47
47
48
+ if (NOT CORTEX_CQA )
49
+ message (STATUS "Setting up optimization flags for Release builds" )
50
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" )
51
+ # Add optimization flags for GCC/Clang
52
+ add_compile_options ($< $< CONFIG:Release> :-O3> )
53
+ add_compile_options ($< $< CONFIG:Release> :-flto> )
54
+ add_link_options ($< $< CONFIG:Release> :-flto> )
55
+ elseif (MSVC )
56
+ # Add optimization flags for MSVC
57
+ add_compile_options ($< $< CONFIG:Release> :/O2> )
58
+ # Optional: Link-time optimization
59
+ add_compile_options ($< $< CONFIG:Release> :/GL> )
60
+ add_link_options ($< $< CONFIG:Release> :/LTCG> )
61
+ endif ()
62
+ endif ()
63
+
48
64
if (MSVC )
49
65
add_compile_options (
50
66
$< $< CONFIG:> :/MT> #---------|
51
67
$< $< CONFIG:Debug> :/MTd> #---|-- Statically link the runtime libraries
52
68
$< $< CONFIG:Release> :/MT> #--|
69
+ $< $< CONFIG:Release> :/O2> #--|-- Optimize for speed in Release mode
70
+ $< $< CONFIG:Release> :/Ob2> #-|-- Inline any suitable function
53
71
)
54
72
55
73
add_compile_options (/utf-8 )
You can’t perform that action at this time.
0 commit comments