mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
c++11: enable c++11 compliance unconditionally.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
dd3e5290b2
commit
94cd7f185f
@ -13,7 +13,6 @@ option (BUILDJAVAEXAMPLES "Build java example jars" OFF)
|
|||||||
option (IPK "Generate IPK using CPack" OFF)
|
option (IPK "Generate IPK using CPack" OFF)
|
||||||
option (RPM "Generate RPM using CPack" OFF)
|
option (RPM "Generate RPM using CPack" OFF)
|
||||||
option (BUILDTESTS "Generate check-ups for upm" ON)
|
option (BUILDTESTS "Generate check-ups for upm" ON)
|
||||||
option (ENABLECXX11 "Enable C++11 standards support" ON)
|
|
||||||
|
|
||||||
# Warn if building in source root
|
# Warn if building in source root
|
||||||
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||||
@ -129,25 +128,21 @@ if (DETECTED_ARCH MATCHES "arm.*" AND NOT CMAKE_CXX_FLAGS MATCHES "-march")
|
|||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# enable c++11 standards support
|
# enable c++11 standards support unconditionally
|
||||||
if (ENABLECXX11)
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckCXXCompilerFlag)
|
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
if (COMPILER_SUPPORTS_CXX11)
|
||||||
if (COMPILER_SUPPORTS_CXX11)
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
elseif (COMPILER_SUPPORTS_CXX0X)
|
||||||
elseif (COMPILER_SUPPORTS_CXX0X)
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
||||||
else()
|
|
||||||
message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please update your C++ compiler.")
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
# 3.1+ uses this generic method to enable c++11
|
message(FATAL_ERROR "A C++11 compliant compiler is required to build UPM.")
|
||||||
set (CMAKE_CXX_STANDARD 11)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "Some modules require C++11 support, and may not build without it.")
|
# 3.1+ uses this generic method to enable c++11
|
||||||
|
set (CMAKE_CXX_STANDARD 11)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The doc target depends on each sensor target
|
# The doc target depends on each sensor target
|
||||||
|
@ -179,22 +179,6 @@ macro(upm_swig_node)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT ENABLECXX11)
|
|
||||||
set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD 11)
|
|
||||||
set_property (TARGET jsupm_${libname} PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7")
|
|
||||||
message (FATAL_ERROR "FATAL_ERROR: GNU gcc compiler is also too old (need 4.7+, but ${CMAKE_CXX_COMPILER_VERSION}) and does not support C++11 standard.")
|
|
||||||
endif ()
|
|
||||||
set (UPM_CXX11_WORKAROUND_OPTION "-std=gnu++11")
|
|
||||||
else ()
|
|
||||||
set (UPM_CXX11_WORKAROUND_OPTION "-std=c++11")
|
|
||||||
endif ()
|
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${UPM_CXX11_WORKAROUND_OPTION} ")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
createpackagejson(${libname})
|
createpackagejson(${libname})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user