summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorManuel Bentele2020-10-13 14:56:57 +0200
committerManuel Bentele2020-10-13 14:56:57 +0200
commit04debdd3f57518aea2d931ce481753103fc05f54 (patch)
tree148b21bc362d34e4d02103d6e93cb958d0e5fd56 /CMakeLists.txt
parent[KERNEL] ported socket time structures to support CentOS 8 kernel 4.18 (diff)
downloaddnbd3-04debdd3f57518aea2d931ce481753103fc05f54.tar.gz
dnbd3-04debdd3f57518aea2d931ce481753103fc05f54.tar.xz
dnbd3-04debdd3f57518aea2d931ce481753103fc05f54.zip
[FUSE] turn on compiler optimization to fix warning
This change enables compiler optimization (-O2) in Release builds to fix the following error warning: _FORTIFY_SOURCE requires compiling with optimization (-O)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89a44eb..079fd9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,7 @@ endmacro()
# Common for gcc and clang
#SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now,-z,defs -pie")
SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG")
-SET(CMAKE_C_FLAGS "-std=c11 -Wno-multichar -fno-strict-aliasing -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 ${EXTRA_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-O2 -std=c11 -Wno-multichar -fno-strict-aliasing -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 ${EXTRA_C_FLAGS}")
# Hardening. Try as much as is possible.
#TRY_ADD_FLAG("-mmitigate-rop")
#TRY_ADD_FLAG("-fstack-protector-strong")
@@ -62,10 +62,10 @@ SET(CMAKE_C_FLAGS "-std=c11 -Wno-multichar -fno-strict-aliasing -D_GNU_SOURCE -D
#TRY_ADD_FLAG("-Werror=format-security")
if(CMAKE_C_COMPILER MATCHES "clang")
message( "Using clang flags." )
- SET(CMAKE_C_FLAGS_DEBUG " -O1 -fno-omit-frame-pointer -g -Wall -Wextra -Wpedantic -Wno-unused-result -D_DEBUG")
+ SET(CMAKE_C_FLAGS_DEBUG " -Og -fno-omit-frame-pointer -g -Wall -Wextra -Wpedantic -Wno-unused-result -D_DEBUG")
elseif (CMAKE_C_COMPILER MATCHES "(cc-)|(cc$)")
message( "Using (g)cc flags." )
- SET(CMAKE_C_FLAGS_DEBUG " -O0 -g -Wall -Wextra -Wpedantic -Wconversion -Wno-sign-conversion -D_DEBUG")
+ SET(CMAKE_C_FLAGS_DEBUG " -Og -g -Wall -Wextra -Wpedantic -Wconversion -Wno-sign-conversion -D_DEBUG")
else()
message( FATAL_ERROR "Could not determine compiler type." )
endif()