Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for the C(XX)_STANDARD and C(XX)_EXTENSIONS.
Also extended the tests to treat warnings (about preprocessor problems) as errors, and added two new tests about the c++ standard version.
- Loading branch information
Showing
16 changed files
with
192 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.3) | ||
cmake_policy(SET CMP0058 NEW) | ||
enable_testing() | ||
project(test-cxx11) | ||
include(../../PrecompiledHeader.cmake) | ||
if(MSVC) | ||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) | ||
set(pch_source test-pch.cpp) | ||
endif() | ||
set(CMAKE_CXX_FLAGS "${CMAKH_CXX_FLAGS} -Werror") | ||
set(CMAKE_C_FLAGS "${CMAKH_CXX_FLAGS} -Werror") | ||
set(CMAKE_CXX_STANDARD 11) | ||
add_executable(test-cxx11 test-cxx.cpp test-pch.h ${pch_source}) | ||
add_precompiled_header(test-cxx11 test-pch.h) | ||
add_test(test-cxx11 test-cxx11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "test-pch.h" | ||
#ifndef PCH | ||
#error Missing precompiled header | ||
#endif | ||
int main() { return !(PCH == atoi(getenv("EXPECTED_PCH"))); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "test-pch.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#define PCH 1 | ||
#ifdef __cplusplus | ||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
#if __cplusplus < 201100L | ||
#error This PCH has to be compiled in C++11 mode | ||
#endif | ||
|
||
#if __cplusplus > 201112L | ||
#error This PCH has to be compiled in C++11 mode | ||
#endif | ||
|
||
#else | ||
#include <stdlib.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required(VERSION 3.3) | ||
cmake_policy(SET CMP0058 NEW) | ||
enable_testing() | ||
project(test-cxx14_noext) | ||
include(../../PrecompiledHeader.cmake) | ||
if(MSVC) | ||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) | ||
set(pch_source test-pch.cpp) | ||
endif() | ||
set(CMAKE_CXX_FLAGS "${CMAKH_CXX_FLAGS} -Werror") | ||
set(CMAKE_C_FLAGS "${CMAKH_CXX_FLAGS} -Werror") | ||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
add_executable(test-cxx14_noext test-cxx.cpp test-pch.h ${pch_source}) | ||
add_precompiled_header(test-cxx14_noext test-pch.h) | ||
add_test(test-cxx14_noext test-cxx14_noext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "test-pch.h" | ||
#ifndef PCH | ||
#error Missing precompiled header | ||
#endif | ||
int main() { return !(PCH == atoi(getenv("EXPECTED_PCH"))); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "test-pch.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#define PCH 1 | ||
#ifdef __cplusplus | ||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
#if __cplusplus < 201400L | ||
#error This PCH has to be compiled in C++14 mode | ||
#endif | ||
|
||
#if __cplusplus > 201412L | ||
#error This PCH has to be compiled in C++14 mode | ||
#endif | ||
|
||
#else | ||
#include <stdlib.h> | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters