Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
47 lines (42 sloc)
1.26 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (c) https://github.com/dev-cafe/autocmake/blob/master/AUTHORS.md | |
# licensed under BSD-3: https://github.com/dev-cafe/autocmake/blob/master/LICENSE | |
#.rst: | |
# | |
# Adds C++ support. | |
# Appends EXTRA_CXXFLAGS to CMAKE_CXX_FLAGS. | |
# If environment variable CXXFLAGS is set, then the CXXFLAGS are used | |
# and no other flags are used or appended. | |
# | |
# Variables used:: | |
# | |
# EXTRA_CXXFLAGS | |
# | |
# Variables modified:: | |
# | |
# CMAKE_CXX_FLAGS | |
# | |
# Environment variables used:: | |
# | |
# CXXFLAGS | |
# | |
# autocmake.yml configuration:: | |
# | |
# docopt: | |
# - "--cxx=<CXX> C++ compiler [default: g++]." | |
# - "--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: '']." | |
# define: "'-DCMAKE_CXX_COMPILER={0} -DEXTRA_CXXFLAGS=\"{1}\"'.format(arguments['--cxx'], arguments['--extra-cxx-flags'])" | |
if(NOT DEFINED CMAKE_CXX_COMPILER_ID) | |
message(FATAL_ERROR "CMAKE_CXX_COMPILER_ID variable is not defined!") | |
endif() | |
if(NOT CMAKE_CXX_COMPILER_WORKS) | |
message(FATAL_ERROR "CMAKE_CXX_COMPILER_WORKS is false!") | |
endif() | |
if(DEFINED EXTRA_CXXFLAGS) | |
if(NOT EXTRA_CXXFLAGS STREQUAL "") | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}") | |
endif() | |
endif() | |
if(DEFINED ENV{CXXFLAGS}) | |
message(STATUS "CXXFLAGS is set to '$ENV{CXXFLAGS}'.") | |
set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS}") | |
endif() |