Changeset View
Changeset View
Standalone View
Standalone View
kde-modules/KDECompilerSettings.cmake
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Line(s) | |||||
199 | 199 | | |||
200 | 200 | | |||
201 | 201 | | |||
202 | ############################################################ | 202 | ############################################################ | ||
203 | # Language and toolchain features | 203 | # Language and toolchain features | ||
204 | ############################################################ | 204 | ############################################################ | ||
205 | 205 | | |||
206 | # Pick sensible versions of the C and C++ standards. | 206 | # Pick sensible versions of the C and C++ standards. | ||
207 | # Note that MSVC does not have equivalent flags; the features are either | 207 | set(CMAKE_C_STANDARD 90) | ||
208 | # supported or they are not. | 208 | set(CMAKE_CXX_STANDARD 11) | ||
dfaure: That's not how it works.
You want
set(CMAKE_CXX_STANDARD 11)
set… | |||||
209 | if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") | | |||
210 | # We use the C89 standard because that is what is common to all our | | |||
211 | # compilers (in particular, MSVC 2010 does not support C99) | | |||
212 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=iso9899:1990") | | |||
213 | endif() | | |||
214 | if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | | |||
215 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | | |||
216 | elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32) | | |||
217 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | | |||
218 | endif() | | |||
219 | 209 | | |||
220 | # Do not merge uninitialized global variables. | 210 | # Do not merge uninitialized global variables. | ||
221 | # This is mostly a "principle of least surprise" thing, but also | 211 | # This is mostly a "principle of least surprise" thing, but also | ||
222 | # has performance benefits. | 212 | # has performance benefits. | ||
223 | # See https://www.ibm.com/developerworks/community/blogs/zTPF/entry/benefits_of_the_fnocommon_compile_option_peter_lemieszewski?lang=en | 213 | # See https://www.ibm.com/developerworks/community/blogs/zTPF/entry/benefits_of_the_fnocommon_compile_option_peter_lemieszewski?lang=en | ||
224 | # Note that this only applies to C code; C++ already behaves like this. | 214 | # Note that this only applies to C code; C++ already behaves like this. | ||
225 | if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR | 215 | if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR | ||
226 | CMAKE_C_COMPILER_ID MATCHES "Clang" OR | 216 | CMAKE_C_COMPILER_ID MATCHES "Clang" OR | ||
▲ Show 20 Lines • Show All 295 Lines • Show Last 20 Lines |
That's not how it works.
You want
Note however that these require CMake >= 3.1, while ECM says cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR). I do however thing that ECM *should* require 3.1.
I doubt it's been tested on 2.8.x in ages, and 3.1 is really a common requirement these days.