mirror of git://sigrok.org/pulseview
Fix CMake CXX_STANDARD handling
https://sigrok.org/gitweb/?p=pulseview.git;a=commit;f=CMakeLists.txt;h=fa8d0fcb4cff4f19943fe3ff152dc1428b400b01 introduced a CXX_STANDARD value of 17 while still only requiring cmake 2.8.12. However, https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#cxx-standard shows that a value of 17 was introduced with cmake 3.8, leading to "CXX_STANDARD is set to invalid value '17'" when trying to build with cmake < 3.8. Hence, for versions below 3.8, we only check for up to 14.
This commit is contained in:
parent
e0a90b4c5d
commit
cb40d40c6c
|
@ -83,23 +83,39 @@ include(memaccess)
|
|||
|
||||
find_package(PkgConfig)
|
||||
|
||||
check_cxx_compiler_flag("-std=c++17" HAVE_STD_CXX_17)
|
||||
check_cxx_compiler_flag("-std=c++14" HAVE_STD_CXX_14)
|
||||
check_cxx_compiler_flag("-std=c++11" HAVE_STD_CXX_11)
|
||||
if(HAVE_STD_CXX_17)
|
||||
message(STATUS "Using C++17 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++17")
|
||||
elseif(HAVE_STD_CXX_14)
|
||||
message(STATUS "Using C++14 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++14")
|
||||
elseif(HAVE_STD_CXX_11)
|
||||
message(STATUS "Using C++11 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++11")
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.8.0")
|
||||
check_cxx_compiler_flag("-std=c++17" HAVE_STD_CXX_17)
|
||||
check_cxx_compiler_flag("-std=c++14" HAVE_STD_CXX_14)
|
||||
check_cxx_compiler_flag("-std=c++11" HAVE_STD_CXX_11)
|
||||
if(HAVE_STD_CXX_17)
|
||||
message(STATUS "Using C++17 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++17")
|
||||
elseif(HAVE_STD_CXX_14)
|
||||
message(STATUS "Using C++14 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++14")
|
||||
elseif(HAVE_STD_CXX_11)
|
||||
message(STATUS "Using C++11 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++11")
|
||||
else()
|
||||
message(FATAL_ERROR "Need modern C++, at least language standard 11")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Need modern C++, at least language standard 11")
|
||||
check_cxx_compiler_flag("-std=c++14" HAVE_STD_CXX_14)
|
||||
check_cxx_compiler_flag("-std=c++11" HAVE_STD_CXX_11)
|
||||
if(HAVE_STD_CXX_14)
|
||||
message(STATUS "Using C++14 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++14")
|
||||
elseif(HAVE_STD_CXX_11)
|
||||
message(STATUS "Using C++11 for the application build")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(REQUIRED_STD_CXX_FLAGS "-std=c++11")
|
||||
else()
|
||||
message(FATAL_ERROR "Need modern C++, at least language standard 11")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND PKGDEPS glib-2.0>=2.28.0)
|
||||
|
|
Loading…
Reference in New Issue