Skip to content

Commit 9a442b4

Browse files
committed
Add C++11/C++14/C++17 compatibility checks
1 parent 12921a2 commit 9a442b4

File tree

95 files changed

+4920
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4920
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build*/
2+
3+
CMakeCache.txt
4+
CMakeFiles/
5+
6+
#vscode
7+
.vscode/
8+
9+
# Jetbrains
10+
.idea/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: cpp
2+
3+
addons:
4+
apt:
5+
sources:
6+
- ubuntu-toolchain-r-test
7+
packages:
8+
- g++-5
9+
10+
install:
11+
- wget --no-check-certificate https://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz
12+
- tar -xzf cmake-3.3.1-Linux-x86_64.tar.gz
13+
- export CC='gcc-5'
14+
- export CXX='g++-5'
15+
script:
16+
- mkdir build && cd build/
17+
- ../cmake-3.3.1-Linux-x86_64/bin/cmake ../_test
18+
- ../cmake-3.3.1-Linux-x86_64/bin/cmake --build .
19+
- ./comp_test
20+
- rm -r *
21+
- ../cmake-3.3.1-Linux-x86_64/bin/cmake -D_COMP_TEST_WORKAROUND=ON ../_test
22+
- ../cmake-3.3.1-Linux-x86_64/bin/cmake --build .
23+
- ./comp_test
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (C) 2015-2016 Jonathan Müller <[email protected]>
2+
3+
This software is provided 'as-is', without any express or
4+
implied warranty. In no event will the authors be held
5+
liable for any damages arising from the use of this software.
6+
7+
Permission is granted to anyone to use this software for any purpose,
8+
including commercial applications, and to alter it and redistribute
9+
it freely, subject to the following restrictions:
10+
11+
1. The origin of this software must not be misrepresented;
12+
you must not claim that you wrote the original software.
13+
If you use this software in a product, an acknowledgment
14+
in the product documentation would be appreciated but
15+
is not required.
16+
17+
2. Altered source versions must be plainly marked as such,
18+
and must not be misrepresented as being the original software.
19+
20+
3. This notice may not be removed or altered from any
21+
source distribution.

cmake/custom/compilers/compatibility/README.md

Lines changed: 426 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (C) 2015-2016 Jonathan Müller <[email protected]>
2+
# This file is subject to the license terms in the LICENSE file
3+
# found in the top-level directory of this distribution.
4+
5+
cmake_minimum_required(VERSION 3.1)
6+
project(COMPATIBILITY_TEST)
7+
8+
set(_COMP_TEST ${CMAKE_CURRENT_BINARY_DIR}/test)
9+
10+
# download catch
11+
file(DOWNLOAD
12+
https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp
13+
${_COMP_TEST}/catch.downloaded
14+
SHOW_PROGESS
15+
STATUS status
16+
LOG log)
17+
18+
list(GET status 0 status_code)
19+
list(GET status 1 status_string)
20+
if((NOT EXISTS ${_COMP_TEST}/catch.hpp) AND (NOT status_code EQUAL 0))
21+
message(FATAL_ERROR "error downloading catch: ${status_string}"
22+
"${log}")
23+
else()
24+
# succesful download, replace old catch.hpp
25+
file(RENAME ${_COMP_TEST}/catch.downloaded ${_COMP_TEST}/catch.hpp)
26+
endif()
27+
28+
include(../comp_base.cmake)
29+
30+
set(feature_names)
31+
file(GLOB features ${CMAKE_CURRENT_SOURCE_DIR}/../*/*.cmake)
32+
file(COPY main.cpp DESTINATION ${_COMP_TEST})
33+
foreach(feature ${features})
34+
get_filename_component(header "${feature}" NAME_WE)
35+
string(TOUPPER "${header}" macro_name)
36+
get_filename_component(dir "${feature}" DIRECTORY)
37+
string(FIND "${dir}" "/" last_sep REVERSE)
38+
math(EXPR last_sep "${last_sep} + 1")
39+
string(SUBSTRING "${dir}" ${last_sep} -1 dir)
40+
41+
file(APPEND ${_COMP_TEST}/main.cpp "#include COMP_${macro_name}_HEADER\n")
42+
list(APPEND feature_names "${dir}/${header}")
43+
endforeach()
44+
45+
add_library(_comp_test_runner INTERFACE)
46+
comp_target_features(_comp_test_runner INTERFACE ${feature_names}
47+
CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../ NOFLAGS)
48+
49+
file(GLOB tests "${_COMP_TEST}/*.cpp")
50+
add_executable(comp_test "${tests}")
51+
comp_target_features(comp_test PRIVATE CPP17)
52+
target_link_libraries(comp_test PUBLIC _comp_test_runner)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define CATCH_CONFIG_MAIN
2+
#define CATCH_CONFIG_COLOUR_NONE
3+
#include "catch.hpp"

0 commit comments

Comments
 (0)