Skip to content

Commit

Permalink
fixup! General CMakeLists improvements - cmake v2→v3
Browse files Browse the repository at this point in the history
Ensuring -O exists in CMAKE_CXX_FLAGS_RELWITHDEBINFO per Duarte's request
  • Loading branch information
kheaactua committed Jan 13, 2025
1 parent b2fb246 commit fb7e0da
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-fno-omit-frame-pointer
)

# Check if optimization level is set in CMAKE_CXX_FLAGS_RELWITHDEBINFO
string(REGEX MATCH "-O([0-3s]?)" OPTIMIZATION_SET "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")

if(NOT OPTIMIZATION_SET)
message(WARNING "No optimization level set in CMAKE_CXX_FLAGS_RELWITHDEBINFO, adding -O")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O")
endif()

target_link_libraries(OS_INTERFACE INTERFACE Threads::Threads)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down

0 comments on commit fb7e0da

Please sign in to comment.