From: Gregor Jasny Date: Tue, 6 Jul 2021 10:49:08 +0000 (+0200) Subject: Require CMake 3.10 (#885) X-Git-Tag: v4.4~153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62c2e7bb8ac0434824e638e97ad455fe4f045e1b;p=thirdparty%2Fccache.git Require CMake 3.10 (#885) Fixes #884. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8824a5b1e..dd1e76e61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,4 @@ -cmake_minimum_required(VERSION 3.4.3) - -if(POLICY CMP0067) - cmake_policy(SET CMP0067 NEW) -endif() +cmake_minimum_required(VERSION 3.10) project(ccache LANGUAGES C CXX) if(MSVC) @@ -76,12 +72,9 @@ include(StandardWarnings) include(CIBuildType) include(DefaultBuildType) -if(NOT ${CMAKE_VERSION} VERSION_LESS "3.9") - cmake_policy(SET CMP0069 NEW) - option(ENABLE_IPO "Enable interprocedural (link time, LTO) optimization" OFF) - if(ENABLE_IPO) - set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) - endif() +option(ENABLE_IPO "Enable interprocedural (link time, LTO) optimization" OFF) +if(ENABLE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) endif() # diff --git a/cmake/CcachePackConfig.cmake b/cmake/CcachePackConfig.cmake index a35949da5..c41aeca99 100644 --- a/cmake/CcachePackConfig.cmake +++ b/cmake/CcachePackConfig.cmake @@ -1,10 +1,6 @@ # Note: This is part of CMakeLists.txt file, not to be confused with # CPackConfig.cmake. -if(${CMAKE_VERSION} VERSION_LESS "3.9") - set(CPACK_PACKAGE_DESCRIPTION "${CMAKE_PROJECT_DESCRIPTION}") -endif() - # From CcacheVersion.cmake. set(CPACK_PACKAGE_VERSION ${CCACHE_VERSION}) diff --git a/cmake/CodeAnalysis.cmake b/cmake/CodeAnalysis.cmake index 1380fab0b..0d3cf024a 100644 --- a/cmake/CodeAnalysis.cmake +++ b/cmake/CodeAnalysis.cmake @@ -1,38 +1,30 @@ option(ENABLE_CPPCHECK "Enable static analysis with Cppcheck" OFF) if(ENABLE_CPPCHECK) - if(${CMAKE_VERSION} VERSION_LESS "3.10") - message(WARNING "Cppcheck requires CMake 3.10") + find_program(CPPCHECK_EXE cppcheck) + mark_as_advanced(CPPCHECK_EXE) # Don't show in CMake UIs + if(CPPCHECK_EXE) + set(CMAKE_CXX_CPPCHECK + ${CPPCHECK_EXE} + --suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt + --inline-suppr + -q + --enable=all + --force + --std=c++14 + -I ${CMAKE_SOURCE_DIR} + --template="cppcheck: warning: {id}:{file}:{line}: {message}" + -i src/third_party) else() - find_program(CPPCHECK_EXE cppcheck) - mark_as_advanced(CPPCHECK_EXE) # Don't show in CMake UIs - if(CPPCHECK_EXE) - set(CMAKE_CXX_CPPCHECK - ${CPPCHECK_EXE} - --suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt - --inline-suppr - -q - --enable=all - --force - --std=c++14 - -I ${CMAKE_SOURCE_DIR} - --template="cppcheck: warning: {id}:{file}:{line}: {message}" - -i src/third_party) - else() - message(WARNING "Cppcheck requested but executable not found") - endif() + message(WARNING "Cppcheck requested but executable not found") endif() endif() option(ENABLE_CLANG_TIDY "Enable static analysis with Clang-Tidy" OFF) if(ENABLE_CLANG_TIDY) - if(${CMAKE_VERSION} VERSION_LESS "3.6") - message(WARNING "Clang-Tidy requires CMake 3.6") + find_program(CLANGTIDY clang-tidy) + if(CLANGTIDY) + set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY}) else() - find_program(CLANGTIDY clang-tidy) - if(CLANGTIDY) - set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY}) - else() - message(SEND_ERROR "Clang-Tidy requested but executable not found") - endif() + message(SEND_ERROR "Clang-Tidy requested but executable not found") endif() endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3dd1a36bd..3e28a03e0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,21 +7,8 @@ function(addtest name) set_tests_properties( "test.${name}" PROPERTIES - ENVIRONMENT "CCACHE=$;EXIT_IF_SKIPPED=true") - - if(${CMAKE_VERSION} VERSION_LESS "3.9") - # Older CMake versions treat skipped tests as errors. Therefore, resort to - # parsing output for those cases (exit code is not considered). Skipped - # tests will appear as "Passed". - set_tests_properties( - "test.${name}" - PROPERTIES - PASS_REGULAR_EXPRESSION "PASSED|Passed|Skipped" - FAIL_REGULAR_EXPRESSION "[Ww]arning|[Ff]ail|[Er]rror") - else() - set_tests_properties("test.${name}" PROPERTIES SKIP_RETURN_CODE 125) - endif() - + ENVIRONMENT "CCACHE=$;EXIT_IF_SKIPPED=true" + SKIP_RETURN_CODE 125) endfunction() if(${CMAKE_VERSION} VERSION_LESS "3.15")