Skip to content

fixed #13343 - Bump cmake_minimum_required() to 3.13 #7213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
cmake_minimum_required(VERSION 3.5)
if(MSVC)
cmake_minimum_required(VERSION 3.13)
endif()
cmake_minimum_required(VERSION 3.13)
project(Cppcheck VERSION 2.16.99 LANGUAGES CXX)

include(cmake/options.cmake)
Expand Down
11 changes: 1 addition & 10 deletions cmake/findDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,7 @@ endif()

set(CMAKE_INCLUDE_CURRENT_DIR ON)

if(CMAKE_VERSION VERSION_EQUAL "3.12" OR CMAKE_VERSION VERSION_GREATER "3.12")
find_package(Python COMPONENTS Interpreter)
else()
find_package(PythonInterp 3 QUIET)
if(PYTHONINTERP_FOUND)
set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python_VERSION ${PYTHON_VERSION_STRING})
set(Python_Interpreter_FOUND ${PYTHONINTERP_FOUND})
endif()
endif()
find_package(Python COMPONENTS Interpreter)

if(NOT Python_Interpreter_FOUND)
if(NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
Expand Down
4 changes: 0 additions & 4 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ else()
set(CMAKE_DISABLE_PRECOMPILE_HEADERS On CACHE BOOL "Disable precompiled headers")
endif()

if(BUILD_TESTS AND REGISTER_TESTS AND CMAKE_VERSION VERSION_LESS "3.9")
message(FATAL_ERROR "Registering tests with CTest requires at least CMake 3.9. Use REGISTER_TESTS=OFF to disable this.")
endif()

set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Output directory for headers")
set(CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH "Output directory for libraries")

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The minimum required Python version is 3.6.

### CMake

The minimum required version is CMake 3.5.
The minimum required version is CMake 3.13.

Example, compiling Cppcheck with cmake:

Expand Down
50 changes: 23 additions & 27 deletions test/signal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
if (CMAKE_VERSION VERSION_EQUAL "3.13" OR CMAKE_VERSION VERSION_GREATER "3.13")
# target_link_options requires CMake 3.13
add_executable(test-signalhandler
test-signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-signalhandler PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# names for static functions are omitted from trace
target_compile_options_safe(test-signalhandler -Wno-missing-declarations)
target_compile_options_safe(test-signalhandler -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-signalhandler PRIVATE -rdynamic)
endif()

add_executable(test-signalhandler
test-signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-signalhandler PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# names for static functions are omitted from trace
target_compile_options_safe(test-signalhandler -Wno-missing-declarations)
target_compile_options_safe(test-signalhandler -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-signalhandler PRIVATE -rdynamic)
endif()

add_executable(test-stacktrace
test-stacktrace.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-stacktrace PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# names for static functions are omitted from trace
target_compile_options_safe(test-stacktrace -Wno-missing-declarations)
target_compile_options_safe(test-stacktrace -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-stacktrace PRIVATE -rdynamic)
endif()
endif()
add_executable(test-stacktrace
test-stacktrace.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-stacktrace PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# names for static functions are omitted from trace
target_compile_options_safe(test-stacktrace -Wno-missing-declarations)
target_compile_options_safe(test-stacktrace -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-stacktrace PRIVATE -rdynamic)
endif()
Loading