Commit 7e699189 authored by Praetorius, Simon's avatar Praetorius, Simon

CMakeLists updated to detect compiler-features

parent 65729524
......@@ -267,6 +267,14 @@ else()
add_library(muparser SHARED ${MUPARSER_SRC})
endif()
if (${CMAKE_VERSION} VERSION_GREATER "3.0")
foreach(feature in ${REQUIRED_CXX_FEATURES})
target_compile_features(amdis INTERFACE feature)
target_compile_features(muparser INTERFACE feature)
endforeach(feature)
endif ()
list(APPEND AMDIS_LIBS amdis ${Boost_LIBRARIES})
# some special treatements for Windows systems
......
# enable the c++11 features. From cmake version 3.0 this is simply done by setting
# the cxx_standard variables. For older cmake version the compile-flags must be added manually.
if (ENABLE_CXX11)
list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
if (${CMAKE_VERSION} VERSION_GREATER "3.0")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(GXX_MIN_VER "4.8")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GXX_MIN_VER)
message (FATAL_ERROR "For C++11-Features the G++ Compiler must be at least version $GXX_MIN_VER")
list(APPEND COMPILEFLAGS "-DHAS_CXX11=1")
if (${CMAKE_VERSION} VERSION_GREATER "3.0")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(REQUIRED_CXX_FEATURES "cxx_alias_templates" "cxx_auto_type" "cxx_lambdas" "cxx_override" "cxx_range_for" "cxx_static_assert" "cxx_variadic_templates")
else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(GXX_MIN_VER "4.8")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GXX_MIN_VER)
message (FATAL_ERROR "For C++11-Features the G++ Compiler must be at least version $GXX_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=gnu++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CLANG_MIN_VER "3.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Clang Compiler must be at least version $CLANG_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(INTEL_MIN_VER "12.1")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS INTEL_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Intel C++ Compiler must be at least version $INTEL_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(MSVC_MIN_VER "12.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_MIN_VER)
message (FATAL_ERROR "For C++11-Features the MSVC C++ Compiler must be at least version $MSVC_MIN_VER")
endif ()
endif ()
list(APPEND COMPILEFLAGS "-std=gnu++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CLANG_MIN_VER "3.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Clang Compiler must be at least version $CLANG_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(INTEL_MIN_VER "12.1")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS INTEL_MIN_VER)
message (FATAL_ERROR "For C++11-Features the Intel C++ Compiler must be at least version $INTEL_MIN_VER")
endif ()
list(APPEND COMPILEFLAGS "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(MSVC_MIN_VER "12.0")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_MIN_VER)
message (FATAL_ERROR "For C++11-Features the MSVC C++ Compiler must be at least version $MSVC_MIN_VER")
endif ()
endif ()
endif()
endif()
else ()
list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
list(APPEND COMPILEFLAGS "-DHAS_CXX11=0")
endif (ENABLE_CXX11)
Markdown is supported
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