File tree Expand file tree Collapse file tree 10 files changed +26
-40
lines changed
Expand file tree Collapse file tree 10 files changed +26
-40
lines changed Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 2.8.12)
2- project (Cppcheck)
1+ cmake_minimum_required (VERSION 3.5)
2+ if (MSVC )
3+ cmake_minimum_required (VERSION 3.13)
4+ endif ()
5+ cmake_policy (SET CMP0048 NEW) # allow VERSION in project()
6+ project (Cppcheck VERSION 2.13.99 LANGUAGES CXX)
37
48include (cmake/cxx11.cmake)
59use_cxx11()
10+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
611
712set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
813
914include (GNUInstallDirs)
1015
11- include (cmake/ccache.cmake)
1216include (cmake/compilerCheck.cmake)
1317include (cmake/versions.cmake)
1418include (cmake/options .cmake)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11if (MSVC )
2+ # add_compile_definitions() requires CMake 3.12
3+
24 # Visual Studio only sets _DEBUG
35 add_compile_definitions ($<$<CONFIG:Debug>:DEBUG>)
46
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
8585
8686 if (USE_LIBCXX)
8787 add_compile_options (-stdlib=libc++)
88- add_link_options ( -lc++)
88+ set ( CMAKE_EXE_LINKER_FLAGS " ${CMAKE_EXE_LINKER_FLAGS} -lc++" )
8989 endif ()
9090
9191 # TODO: fix and enable these warnings - or move to suppression list below
@@ -133,6 +133,8 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
133133endif ()
134134
135135if (MSVC )
136+ # add_link_options() requires CMake 3.13
137+
136138 # General
137139 add_compile_options (/W4) # Warning Level
138140 add_compile_options (/Zi) # Debug Information Format - Program Database
Original file line number Diff line number Diff line change 11macro (use_cxx11)
2- if (CMAKE_VERSION VERSION_LESS "3.1" )
3- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
4- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
5- elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
6- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
7- endif ()
2+ # some GitHub Action Windows runners randomly fail with a complaint that Qt6 requires a C++17 compiler
3+ if (MSVC AND USE_QT6)
4+ # CMAKE_CXX_STANDARD 17 was added in CMake 3.8
5+ set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use" )
86 else ()
9- # some GitHub Action windows runners randomly fail with a complaint that Qt6 requires a C++17 compiler
10- if (MSVC )
11- set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use" )
12- else ()
13- set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use" )
14- endif ()
15- set (CMAKE_CXX_STANDARD_REQUIRED ON )
16- if (POLICY CMP0025)
17- cmake_policy (SET CMP0025 NEW)
18- endif ()
19- endif ()
7+ set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use" )
8+ endif ()
209endmacro (use_cxx11)
Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ else()
7272 set (CMAKE_DISABLE_PRECOMPILE_HEADERS On CACHE BOOL "Disable precompiled headers" )
7373endif ()
7474
75+ if (BUILD_TESTS AND REGISTER_TESTS AND CMAKE_VERSION VERSION_LESS "3.9" )
76+ message (FATAL_ERROR "Registering tests with CTest requires at least CMake 3.9. Use REGISTER_TESTS=OFF to disable this." )
77+ endif ()
78+
7579set (CMAKE_INCLUDE_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX} /include CACHE PATH "Output directory for headers" )
7680set (CMAKE_LIB_DIRS_CONFIGCMAKE ${CMAKE_INSTALL_PREFIX} /lib CACHE PATH "Output directory for libraries" )
7781
Original file line number Diff line number Diff line change 1- message ( STATUS "------------------ General configuration for ${PROJECT_NAME} ${VERSION } -----------------" )
1+ message ( STATUS "------------------ General configuration for ${PROJECT_NAME} ${PROJECT_VERSION } -----------------" )
22message ( STATUS )
33message ( STATUS "CMake Version = ${CMAKE_VERSION} " )
44message ( STATUS "CMake Generator = ${CMAKE_GENERATOR} " )
Original file line number Diff line number Diff line change 11# Version for libraries CPP
22# Version string must have 3 "parts". https://sourceforge.net/p/cppcheck/discussion/development/thread/e57efb2b62/
3- SET (VERSION "2.12.99" )
4- STRING (REGEX MATCHALL "[0-9]+" VERSION_PARTS "${VERSION} " )
5- LIST (GET VERSION_PARTS 0 VERSION_MAJOR)
6- LIST (GET VERSION_PARTS 1 VERSION_MINOR)
7- LIST (GET VERSION_PARTS 2 VERSION_PATCH)
8- SET (SOVERSION "${VERSION_MAJOR} .${VERSION_MINOR} .${VERSION_PATCH} " )
3+ SET (SOVERSION "${PROJECT_VERSION_MAJOR} .${PROJECT_VERSION_MINOR} .${PROJECT_VERSION_PATCH} " )
94
105# Postfix of so's:
116SET (DLLVERSION "" )
Original file line number Diff line number Diff line change @@ -17,3 +17,4 @@ Deprecations:
1717
1818Other:
1919- Added CMake option 'EXTERNALS_AS_SYSTEM' to treat external includes as 'SYSTEM' ones.
20+ - Using Visual Studio with CMake now checks if the CMake version is at least 3.13. This was always required but was not checked explicitly.
Original file line number Diff line number Diff line change @@ -60,11 +60,7 @@ if (BUILD_TESTS)
6060 endif ()
6161
6262 if (REGISTER_TESTS)
63- # CMP0064 requires 3.4
64- # CMAKE_MATCH_<n> usage for if (MATCHES) requires 3.9
65- cmake_minimum_required (VERSION 3.9)
66- cmake_policy (SET CMP0064 NEW)
67- cmake_policy (SET CMP0057 NEW)
63+ # CMAKE_MATCH_<n> usage for if (MATCHES) requires CMake 3.9
6864
6965 find_package (Threads REQUIRED)
7066 include (ProcessorCount)
You can’t perform that action at this time.
0 commit comments