mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-08 22:57:52 +00:00
Merge pull request #100 from hagen-i2p/cxx11-support
Detect c++11 support by compiler
This commit is contained in:
commit
9e4cac2373
@ -1,5 +1,16 @@
|
|||||||
CC = g++
|
CC = g++
|
||||||
CFLAGS = -g -Wall -std=c++0x
|
CFLAGS = -g -Wall
|
||||||
|
CXXVER := $(shell ${CC} -dumpversion)
|
||||||
|
ifeq ($(shell expr match ${CXXVER} "4\.[0-5]"),3)
|
||||||
|
$(error Compiler too old)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (${CXXVER},"4.6")
|
||||||
|
CFLAGS += -std=c++0x
|
||||||
|
else
|
||||||
|
CFLAGS += -std=c++11
|
||||||
|
endif
|
||||||
|
|
||||||
include filelist.mk
|
include filelist.mk
|
||||||
INCFLAGS =
|
INCFLAGS =
|
||||||
LDFLAGS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
LDFLAGS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
|
||||||
|
@ -58,8 +58,20 @@ endif ()
|
|||||||
|
|
||||||
# compiler flags customization (by vendor)
|
# compiler flags customization (by vendor)
|
||||||
add_definitions ( "-Wall -Wextra" )
|
add_definitions ( "-Wall -Wextra" )
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
|
# check for c++11 support
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX11_SUPPORTED)
|
||||||
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" CXX0X_SUPPORTED)
|
||||||
|
if (CXX11_SUPPORTED)
|
||||||
add_definitions( "-std=c++11" )
|
add_definitions( "-std=c++11" )
|
||||||
|
elseif (CXX0X_SUPPORTED) # gcc 4.6
|
||||||
|
add_definitions( "-std=c++0x" )
|
||||||
|
else ()
|
||||||
|
message(SEND_ERROR "C++11 standart not seems to be supported by compiler. Too old version?")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
if (WITH_HARDENING)
|
if (WITH_HARDENING)
|
||||||
add_definitions( "-D_FORTIFY_SOURCE=2" )
|
add_definitions( "-D_FORTIFY_SOURCE=2" )
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat -Wformat-security -Werror=format-security" )
|
||||||
@ -67,7 +79,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie" )
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie" )
|
||||||
endif ()
|
endif ()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
add_definitions( "-std=c++11" )
|
# more tweaks
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# compiler flags customization (by system)
|
# compiler flags customization (by system)
|
||||||
@ -105,6 +117,7 @@ include_directories( ${Boost_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR})
|
|||||||
message(STATUS "---------------------------------------")
|
message(STATUS "---------------------------------------")
|
||||||
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
|
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
|
||||||
message(STATUS "Compiler vendor : ${CMAKE_CXX_COMPILER_ID}")
|
message(STATUS "Compiler vendor : ${CMAKE_CXX_COMPILER_ID}")
|
||||||
|
message(STATUS "Compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
|
||||||
message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")
|
message(STATUS "Compiler path : ${CMAKE_CXX_COMPILER}")
|
||||||
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
|
3
debian/control
vendored
3
debian/control
vendored
@ -2,7 +2,8 @@ Source: i2pd
|
|||||||
Section: net
|
Section: net
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: hagen <hagen@i2pmail.org>
|
Maintainer: hagen <hagen@i2pmail.org>
|
||||||
Build-Depends: debhelper (>= 8.0.0), cmake, dpkg-dev (>= 1.16.1~),
|
Build-Depends: debhelper (>= 8.0.0), dpkg-dev (>= 1.16.1~),
|
||||||
|
cmake (>= 2.8), gcc (>= 4.6) | clang (>= 3.3),
|
||||||
libboost-regex-dev,
|
libboost-regex-dev,
|
||||||
libboost-system-dev (>= 1.46),
|
libboost-system-dev (>= 1.46),
|
||||||
libboost-date-time-dev,
|
libboost-date-time-dev,
|
||||||
|
Loading…
Reference in New Issue
Block a user