]> git.pld-linux.org Git - packages/akonadi.git/blame - 0009-Test-whether-compiler-supports-all-required-C-11-fea.patch
boost rebuild
[packages/akonadi.git] / 0009-Test-whether-compiler-supports-all-required-C-11-fea.patch
CommitLineData
8a8f9fb3
AM
1From e1c69c277ea6005cc358434679b83fa1cb752756 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil@redhat.com>
3Date: Tue, 23 Sep 2014 18:00:34 +0200
4Subject: [PATCH 09/30] Test whether compiler supports all required C++11
5 features at configure time
6
7To prevent ugly compilation errors when someone tries to compile Akonadi
8with a compiler that does not support all C++11 features we use, we run
9a try_compile check in CMakeLists.txt.
10---
11 CMakeLists.txt | 18 ++++++++++++++++++
12 1 file changed, 18 insertions(+)
13
14diff --git a/CMakeLists.txt b/CMakeLists.txt
15index e081d23..2d790c9 100644
16--- a/CMakeLists.txt
17+++ b/CMakeLists.txt
18@@ -216,6 +216,24 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER MATCHES "icc" OR (CMAKE_CXX_COMP
19 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -Wextra -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
20 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wnon-virtual-dtor -Wundef -Wcast-align -Wchar-subscripts -Wall -Wextra -Wpointer-arith -Wformat-security -fno-common")
21
22+ file(WRITE ${CMAKE_BINARY_DIR}/cxx11_check.cpp
23+ "enum Enum { Value = 1 };
24+ struct Class {
25+ Class(int val) { (void)val; };
26+ // Delegating constructor
27+ Class(): Class(42) {};
28+ // New-style enumerator
29+ Class(Enum e = Enum::Value) { (void)e; };
30+ };
31+ int main() {}
32+ ")
33+ try_compile(CXX11_SUPPORTED
34+ ${CMAKE_BINARY_DIR}/cxx11_check
35+ ${CMAKE_BINARY_DIR}/cxx11_check.cpp)
36+ if (NOT CXX11_SUPPORTED)
37+ message(FATAL_ERROR "Compiler does not support all required C++11 features")
38+ endif()
39+
40 # debugfull target
41 set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline" CACHE STRING "Flags used by the C++ compiler during debugfull builds." FORCE)
42 set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline" CACHE STRING "Flags used by the C compiler during debugfull builds." FORCE)
43--
442.1.0
45
This page took 0.059145 seconds and 4 git commands to generate.