Mercurial > malikania
changeset 31:3b1a7d8ef753
CMake: use CMAKE_CXX_STANDARD, #521
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 17 Jun 2016 13:02:06 +0200 |
parents | a1e80d991968 |
children | 81292e0651d2 |
files | CMakeLists.txt cmake/MalikaniaSystem.cmake |
diffstat | 2 files changed, 7 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Jun 16 13:35:31 2016 +0200 +++ b/CMakeLists.txt Fri Jun 17 13:02:06 2016 +0200 @@ -26,6 +26,8 @@ "${malikania_SOURCE_DIR}/cmake/packages" ) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) include(cmake/MalikaniaVersion.cmake)
--- a/cmake/MalikaniaSystem.cmake Thu Jun 16 13:35:31 2016 +0200 +++ b/cmake/MalikaniaSystem.cmake Fri Jun 17 13:02:06 2016 +0200 @@ -16,38 +16,12 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -# -# Recent versions of CMake has nice C++ feature detection for modern -# C++ but they are still a bit buggy so we use this -# instead. -# -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # - # For GCC, we require at least GCC 5.1 - # - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1") - message(FATAL_ERROR "You need at least GCC 5.1") - endif () +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic ${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++14 ${CMAKE_CXX_FLAGS}") -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # - # LLVM/clang implemented C++14 starting from version 3.4 but the - # switch -std=c++14 was not available. - # - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4") - message(FATAL_ERROR "You need at least Clang 3.4") + if (MINGW) + set(CMAKE_CXX_FLAGS "-D_WIN32_WINNT=0x0600 ${CMAKE_CXX_FLAGS}") endif () - - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5") - set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++1y ${CMAKE_CXX_FLAGS}") - else () - set(CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++14 ${CMAKE_CXX_FLAGS}") - endif () -else () - message(WARNING "Unsupported ${CMAKE_CXX_COMPILER_ID}, may not build correctly.") endif () -if (MINGW) - set(CMAKE_CXX_FLAGS "-D_WIN32_WINNT=0x0600 ${CMAKE_CXX_FLAGS}") -endif () +