Commit c9adc753 authored by Andrea Valassi's avatar Andrea Valassi
Browse files

Add c++1y for gcc49 and c++14 for clang and gcc5x as agreed in the LCG

build policies (CORALCOOL-2854). Allow the specification of build flags
from outside cmake via CMAKE_CXX_FLAGS (e.g. by lcgcmake); use the
c++xx build option specified in CMAKE_CXX_FLAGS if any, otherwise use
c++1y for gcc49, c++14 for clang and gcc5x, and c++11 in all other cases.


git-svn-id: file:///git/lcgcool.svndb/cool/trunk@19881 4525493e-7705-40b1-a816-d608a930855b
parent 91214930
# Build options # Build options
option(BUILD_SHARED_LIBS "Set to OFF to build static libraries." ON) option(BUILD_SHARED_LIBS "Set to OFF to build static libraries." ON)
# Build flags # Build flags (C++ std)
# [NB Keep flags passed from outside, e.g. from lcgcmake (CORALCOOL-2854)]
IF(NOT CMAKE_CXX_FLAGS MATCHES "std=c\\+\\+11" AND NOT CMAKE_CXX_FLAGS MATCHES "std=c\\+\\+1y" AND NOT CMAKE_CXX_FLAGS MATCHES "std=c\\+\\+14")
IF(BINARY_TAG MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
ELSEIF(BINARY_TAG MATCHES "gcc5")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
ELSEIF(BINARY_TAG MATCHES "gcc49")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
ELSEIF(BINARY_TAG MATCHES "gcc48")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()
ENDIF()
# Build flags (warnings and other common options)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -fPIC")
# Build flags (other platform-dependent settings)
IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") IF(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSEIF(BINARY_TAG MATCHES "clang35") # See CORALCOOL-2821 ELSEIF(BINARY_TAG MATCHES "clang35") # See CORALCOOL-2821
###set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC --gcc-toolchain=/afs/cern.ch/sw/lcg/external/gcc/4.9.1/x86_64-slc6") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=/cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.1/x86_64-slc6") # cvmfs instead of AFS, see CORALCOOL-2855
set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC --gcc-toolchain=/cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.1/x86_64-slc6")
ELSEIF(BINARY_TAG MATCHES "clang37") # See CORALCOOL-2821 ELSEIF(BINARY_TAG MATCHES "clang37") # See CORALCOOL-2821
###set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC --gcc-toolchain=/afs/cern.ch/sw/lcg/external/gcc/4.9.3/x86_64-slc6") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=/cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.3/x86_64-slc6") # cvmfs instead of AFS, see CORALCOOL-2855
set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC --gcc-toolchain=/cvmfs/sft.cern.ch/lcg/releases/gcc/4.9.3/x86_64-slc6") # use cvmfs, see CORALCOOL-2855
ELSE() ELSE()
set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Wno-long-long -Wno-deprecated -pthread -std=c++11 -fPIC -Wl,--no-undefined") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined")
ENDIF() ENDIF()
message(STATUS "Using CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
...@@ -96,6 +96,9 @@ export CCACHE_DIR=$topdir/.ccache # keep this here to allow interactive queries ...@@ -96,6 +96,9 @@ export CCACHE_DIR=$topdir/.ccache # keep this here to allow interactive queries
export LCG_releases_base=/cvmfs/sft.cern.ch/lcg/releases/LCG_${lcg_xx} export LCG_releases_base=/cvmfs/sft.cern.ch/lcg/releases/LCG_${lcg_xx}
export CORALCOOL_CMAKE_LCGSUMMARY=${LCG_releases_base}/LCG_externals_${BINARY_TAG}.txt export CORALCOOL_CMAKE_LCGSUMMARY=${LCG_releases_base}/LCG_externals_${BINARY_TAG}.txt
# Test passing CMAKE_CXX_FLAGS as in lcgcmake
###export CMAKEFLAGS="-DCMAKE_CXX_FLAGS=-std=c++1y $CMAKEFLAGS"
# Add setup overrides if any are present # Add setup overrides if any are present
if [ -f $topdir/overrideSetupCMake.sh ]; then if [ -f $topdir/overrideSetupCMake.sh ]; then
echo "INFO: override defaults using $topdir/overrideSetupCMake.sh" echo "INFO: override defaults using $topdir/overrideSetupCMake.sh"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment