Skip to content

Commit

Permalink
CMake: Use CommonBuildFlags instead of individual DpkgBuildFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
j1elo committed Jun 14, 2018
1 parent bb49958 commit 6e16067
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,10 @@ install_git_hook(pre-commit ${CMAKE_CURRENT_SOURCE_DIR}/hooks/pre-commit.hook)
get_git_version(PROJECT_VERSION ${VALUE_VERSION})
message(STATUS "Project version: ${PROJECT_NAME}-${PROJECT_VERSION}")

# Set GCC flags common to all projects
# Note: Flags added from dpkg-buildflags (if installed):
# -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
include(DpkgBuildFlags)
dpkg_buildflags_get_cflags(DPKG_BUILDFLAGS_C)
dpkg_buildflags_get_cflagsxx(DPKG_BUILDFLAGS_CXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DPKG_BUILDFLAGS_C} -std=c11 -Wall -Werror -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DPKG_BUILDFLAGS_CXX} -std=c++11 -Wall -Werror -pthread")
set(CMAKE_C_FLAGS_DEBUG "-g -O0") # FIXME Ideal is '-Og' but a bug in GCC prevents this,
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") # causing "may be used uninitialized" errors: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58455
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2") # CMake adds '-O3' by default
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2") # but currently only '-O2' is tested
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Use "-fPIC" for all targets, including static libs
# Compiler flags
include(CommonBuildFlags)
common_buildflags_set()
#common_buildflags_print()

# FIXME Disable error when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered
include(CheckCXXCompilerFlag)
Expand Down

0 comments on commit 6e16067

Please sign in to comment.