Files
wlan-cloud-lib-poco/build/script/cpp11-gcc
zosrothko ba60e328b1 Travis CI (#2050)
* Factorize info into new verbose file. Refactor Makefile, global, cpp11*. Add Linux32-clang

* Display used config with POCO_VERBOSE

* Add cross compilation toward x86 with host amd64

* Refactor config names

* Add lib32gcc runtime

* Add g++-5-multilib

* Use OSARCH=i386 for OSX x86

* Avoid building Crypto since OpenSSL is only x64 on OSX

* Avoid building Crypto since OpenSSL is only x64

* Avoid Data/* on cross compilation to x86

* Add gcc-5-multilib to clang 4.0 x86

* Ignore TimerTest on OSX for now.

* Cleanup

* Add other set of TimerTest.

* New test that fails on OSX
2017-12-18 11:45:07 +01:00

41 lines
1.4 KiB
Bash

#! /bin/sh
#
# cpp11-gcc
#
# Detect compatible GCC version and add c++11/14 flags
#
# From the online doc
# __CXXC__
# __CXXC_MINOR__
# __CXXC_PATCHLEVEL__
# These macros are defined by all CXX compilers that use the C preprocessor: C, C++, Objective-C and Fortran.
# Their values are the major version, minor version, and patch level of the compiler, as integer constants.
# For example, GCC 3.2.1 will define __CXXC__ to 3, __CXXC_MINOR__ to 2, and __CXXC_PATCHLEVEL__ to 1. i
# These macros are also defined if you invoke the preprocessor directly.
#
# __VERSION__
# This macro expands to a string constant which describes the version of the compiler in use.
# You should not rely on its contents having any particular form, but it can be counted on to contain
# at least the release number.
#
CXXMAJOR := $(shell $(CXX) -E -dM - < /dev/null | grep __GNUC__ | sed -e 's/^.* //g')
CXXMINOR := $(shell $(CXX) -E -dM - < /dev/null | grep __GNUC_MINOR__ | sed -e 's/^.* //g')
CXXPATCH := $(shell $(CXX) -E -dM - < /dev/null | grep __GNUC_PATCHLEVEL__ | sed -e 's/^.* //g')
CXXVERSION := $(CXXMAJOR)$(CXXMINOR)$(CXXPATCH)
#
# GCC 4.8 (or 4.6?) doesn't accept -std=c++11, only -std=c++0x.
#
# C++14 needs GCC 4.9.2
ifeq ($(shell test $(CXXVERSION) -ge 492 && echo 1), 1)
CXXFLAGS += -std=c++14
# C++11 needs GCC 4.8.1
else ifeq ($(shell test $(CXXVERSION) -ge 481 && echo 1), 1)
CXXFLAGS += -std=c++11
else
CXXFLAGS += -std=c++03
endif