Skip to content

Commit

Permalink
Merge pull request #660 from wlemkows/add-compiler-flags
Browse files Browse the repository at this point in the history
Add strongly recommended security compiler flags
  • Loading branch information
pbalcer authored Jul 13, 2023
2 parents 566169d + 64a847b commit efee787
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ if(NOT MSVC)
add_compile_options(-fPIC -Wall -Wpedantic
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics>)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_options(-D_FORTIFY_SOURCE=2)
endif()
if(UR_DEVELOPER_MODE)
add_compile_options(-Werror -fno-omit-frame-pointer)
add_compile_options(-Werror -fno-omit-frame-pointer -fstack-protector-strong)
endif()
# Determine if libstdc++ is being used.
check_cxx_source_compiles("
Expand All @@ -81,7 +84,7 @@ elseif(MSVC)
add_compile_options(/MP /W3 /MD$<$<CONFIG:Debug>:d>)

if(UR_DEVELOPER_MODE)
add_compile_options(/WX)
add_compile_options(/WX /GS)
endif()
endif()

Expand Down

0 comments on commit efee787

Please sign in to comment.