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()
4545 message (STATUS "CORTEX_CQA is OFF." )
4646endif ()
4747
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+
4864if (MSVC )
4965 add_compile_options (
5066 $<$<CONFIG:>:/MT> #---------|
5167 $<$<CONFIG:Debug>:/MTd> #---|-- Statically link the runtime libraries
5268 $<$<CONFIG:Release>:/MT> #--|
69+ $<$<CONFIG:Release>:/O2> #--|-- Optimize for speed in Release mode
70+ $<$<CONFIG:Release>:/Ob2> #-|-- Inline any suitable function
5371 )
5472
5573 add_compile_options (/utf-8)
You can’t perform that action at this time.
0 commit comments