bump required cmake to 3.1, use CMAKE_CXX_STANDARD to require C++-11

This commit is contained in:
Patrick Brosi 2023-10-17 14:42:28 +02:00
parent 363c52252d
commit 096d6800df

View file

@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 2.8.12) cmake_minimum_required (VERSION 3.1)
set(CMAKE_CXX_STANDARD 11)
project (pfaedle) project (pfaedle)
@ -25,22 +26,6 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -g -DLOGLEVEL=3")
# export compile commands to tools like clang # export compile commands to tools like clang
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Compiler-specific C++11 activation.
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if ((GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else ()
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater!")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPFAEDLE_PRECISION=${PFAEDLE_PRECISION}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPFAEDLE_PRECISION=${PFAEDLE_PRECISION}")
find_package(LibZip) find_package(LibZip)