diff options
author | Hannah von Reth <vonreth@kde.org> | 2019-10-21 21:00:30 +0200 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2019-10-22 18:54:07 +0200 |
commit | 6e3c794e7c637141613cc180d631c9eed319a72d (patch) | |
tree | 636cab9beee7a3d519d6427a1a3602b2ead2d54a /kde-modules/KDECompilerSettings.cmake | |
parent | 5ca01895e3c50322f79feeef5054d7f28b164d68 (diff) | |
download | extra-cmake-modules-6e3c794e7c637141613cc180d631c9eed319a72d.tar.gz extra-cmake-modules-6e3c794e7c637141613cc180d631c9eed319a72d.tar.bz2 |
Use modern way to set the C/CXX standad
Summary:
This allows later modification of the selected standard.
Raise C from C89 to C90 as C89 is not supported by the CMAKE flag
https://cmake.org/cmake/help/v3.16/prop_tgt/C_STANDARD.html#prop_tgt:C_STANDARD
Subscribers: kde-frameworks-devel, kde-buildsystem
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D24841
Diffstat (limited to 'kde-modules/KDECompilerSettings.cmake')
-rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 7eb5cd41..b5fcf661 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -204,18 +204,9 @@ endif() ############################################################ # Pick sensible versions of the C and C++ standards. -# Note that MSVC does not have equivalent flags; the features are either -# supported or they are not. -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - # We use the C89 standard because that is what is common to all our - # compilers (in particular, MSVC 2010 does not support C99) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=iso9899:1990") -endif() -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -endif() +set(CMAKE_C_STANDARD 90) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED True) # Do not merge uninitialized global variables. # This is mostly a "principle of least surprise" thing, but also |