]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Require C++14-compatible compiler to build ccache
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 18 Jun 2021 18:47:17 +0000 (20:47 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 19 Jun 2021 17:58:58 +0000 (19:58 +0200)
Ccache 4.0 introduced a requirement on a C++11-compatible compiler. The
language version was primarily chosen to support CentOS 7.

The time has now come to bump to C++14, to among other things get access
to generic lambda expressions and improved constexpr functions. Another
side effect is to get usable support for std::regex due to requiring a
newer GCC than 4.8 which lacks such support.

.github/workflows/build.yaml
CMakeLists.txt
cmake/CodeAnalysis.cmake
cmake/DevModeWarnings.cmake
cmake/StandardSettings.cmake
doc/INSTALL.md
dockerfiles/centos-7/Dockerfile
misc/test-all-systems
src/Logging.hpp

index 8e9ed6c36c9db071f22b0ee0562c5cae8b972663..9c6d5b12353a7dec80985a159e93d001f3ac1e39 100644 (file)
@@ -22,10 +22,6 @@ jobs:
       fail-fast: false
       matrix:
         config:
-          - os: ubuntu-18.04
-            compiler: gcc
-            version: "4.8" # results in 4.8.5
-
           - os: ubuntu-18.04
             compiler: gcc
             version: "5"
@@ -155,14 +151,14 @@ jobs:
       fail-fast: false
       matrix:
         config:
-          - name: Linux GCC debug + C++14 + in source + tracing
+          - name: Linux GCC debug + in source + tracing
             os: ubuntu-18.04
             CC: gcc
             CXX: g++
             ENABLE_CACHE_CLEANUP_TESTS: 1
             BUILDDIR: .
             CCACHE_LOC: .
-            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DENABLE_TRACING=1 -DCMAKE_CXX_STANDARD=14
+            CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DENABLE_TRACING=1
             apt_get: elfutils libzstd-dev
 
           - name: Linux GCC 32-bit
index 75342b531a81d154623ae48873273efbb4d48eb6..3554e8f6565fb911a85709ec2244a9284c12514d 100644 (file)
@@ -8,8 +8,10 @@ else()
 endif()
 set(CMAKE_PROJECT_DESCRIPTION "a fast C/C++ compiler cache")
 
-if(NOT "${CMAKE_CXX_STANDARD}")
-  set(CMAKE_CXX_STANDARD 11)
+if(MSVC)
+  set(CMAKE_CXX_STANDARD 17) # Need support for std::filesystem
+else()
+  set(CMAKE_CXX_STANDARD 14)
 endif()
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 set(CMAKE_CXX_EXTENSIONS NO)
@@ -29,7 +31,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 #
 
 if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
-   OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.4)
+   OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
    OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
   message(
     FATAL_ERROR
@@ -38,7 +40,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSIO
 endif()
 
 if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4)
-    OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
+    OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6))
   message(
     WARNING
     "The compiler you are using is rather old.\n"
index 4e639a78629ed48e248dfba6ad57bacea1db317d..1380fab0b5c7b196a62e9128b2c47c5a120faa66 100644 (file)
@@ -13,7 +13,7 @@ if(ENABLE_CPPCHECK)
           -q
           --enable=all
           --force
-          --std=c++11
+          --std=c++14
           -I ${CMAKE_SOURCE_DIR}
           --template="cppcheck: warning: {id}:{file}:{line}: {message}"
           -i src/third_party)
index 7ff5411b89acd3ff7f47026b557c8d758f27323b..ee464763c5b0219cfe3234cdcbf9d1e21ae4cf9a 100644 (file)
@@ -82,8 +82,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
     CCACHE_COMPILER_WARNINGS "-Wno-zero-as-null-pointer-constant")
   add_compile_flag_if_supported(
     CCACHE_COMPILER_WARNINGS "-Wno-undefined-func-template")
-  add_compile_flag_if_supported(
-    CCACHE_COMPILER_WARNINGS "-Wno-return-std-move-in-c++11")
 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
   list(
     APPEND
index 46854f3c00af9ce0cf76db2a3f245232f64034b5..b0fa8b5f7dc95d640a88a62fb403d62a35e118e4 100644 (file)
@@ -56,6 +56,6 @@ elseif(MSVC)
 
   target_compile_options(
     standard_settings
-    INTERFACE /std:c++latest /Zc:preprocessor /Zc:__cplusplus /D_CRT_SECURE_NO_WARNINGS
+    INTERFACE /Zc:preprocessor /Zc:__cplusplus /D_CRT_SECURE_NO_WARNINGS
   )
 endif()
index a90a24f92a7a22930ba39bb5eb59a5031fb5f93d..fab33f10c96073e9b48d6da65ee307a4a6bee8d3 100644 (file)
@@ -7,7 +7,7 @@ Prerequisites
 To build ccache you need:
 
 - CMake 3.4.3 or newer.
-- A C++11 compiler. See [Supported platforms, compilers and
+- A C++14 compiler. See [Supported platforms, compilers and
   languages](https://ccache.dev/platform-compiler-language-support.html) for
   details.
 - A C99 compiler.
index 89a122f0490fa404930c34b10986751847d432ca..dc1c9f9d513a7d365ab65ef41947469cfe6f8ae6 100644 (file)
@@ -1,6 +1,7 @@
 FROM centos:7
 
 RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
+ && yum install -y centos-release-scl \
  && yum install -y \
         asciidoc \
         autoconf \
@@ -8,6 +9,7 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
         ccache \
         clang \
         cmake3 \
+        devtoolset-8 \
         elfutils \
         gcc \
         gcc-c++ \
@@ -19,3 +21,5 @@ RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
  && yum clean all \
  && cp /usr/bin/cmake3 /usr/bin/cmake \
  && cp /usr/bin/ctest3 /usr/bin/ctest
+
+ENTRYPOINT ["scl", "enable", "devtoolset-8", "--"]
index ebf6e6837101fc865a61fb449a2708da16c03b34..349d3fd1b5e09ac82038909ff6b5efa8613eff4e 100755 (executable)
@@ -26,9 +26,6 @@ build debian-9     clang clang++ clang
 build debian-10    gcc   g++     gcc
 build debian-10    clang clang++ clang
 
-build ubuntu-14.04 gcc   g++     gcc     -DZSTD_FROM_INTERNET=ON
-build ubuntu-14.04 gcc   g++     clang   -DZSTD_FROM_INTERNET=ON
-
 build ubuntu-16.04 gcc   g++     gcc
 build ubuntu-16.04 gcc   g++     clang
 
index 38553f25f0054374173d7d6697dd7b09611498a3..5c780ec15cd27121cd01327412d743e88185a87e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2021 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
   } while (false)
 
 // Log a message (plus a newline character) described by a format string with at
-// least one placeholder. `format` is compile-time checked if CMAKE_CXX_STANDARD
-// >= 14.
+// least one placeholder. `format` is checked at compile time.
 #define LOG(format_, ...) LOG_RAW(fmt::format(FMT_STRING(format_), __VA_ARGS__))
 
 // Log a message (plus a newline character) described by a format string with at
 // least one placeholder without flushing and with a reused timestamp. `format`
-// is compile-time checked if CMAKE_CXX_STANDARD >= 14.
+// is checked at compile time.
 #define BULK_LOG(format_, ...)                                                 \
   do {                                                                         \
     if (Logging::enabled()) {                                                  \