-
Notifications
You must be signed in to change notification settings - Fork 1.5k
modernized and cleaned up CMake files / explicitly check for CMake 3.13 with Visual Studio #5825
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
| project(Cppcheck) | ||
| if (MSVC) | ||
| cmake_minimum_required(VERSION 3.13) | ||
| endif() | ||
| cmake_policy(SET CMP0048 NEW) # allow VERSION in project() | ||
| project(Cppcheck VERSION 2.13.99 LANGUAGES CXX) | ||
|
|
||
| include(cmake/cxx11.cmake) | ||
| use_cxx11() | ||
| set (CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved from |
||
|
|
||
| set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
|
||
| include(GNUInstallDirs) | ||
|
|
||
| include(cmake/ccache.cmake) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer necessary. Was a work around for CMake 2.8. |
||
| include(cmake/compilerCheck.cmake) | ||
| include(cmake/versions.cmake) | ||
| include(cmake/options.cmake) | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,9 @@ | ||
| macro(use_cxx11) | ||
| if (CMAKE_VERSION VERSION_LESS "3.1") | ||
| if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | ||
| elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
| endif () | ||
| # some GitHub Action Windows runners randomly fail with a complaint that Qt6 requires a C++17 compiler | ||
| if (MSVC AND USE_QT6) | ||
| # CMAKE_CXX_STANDARD 17 was added in CMake 3.8 | ||
| set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use") | ||
| else () | ||
| # some GitHub Action windows runners randomly fail with a complaint that Qt6 requires a C++17 compiler | ||
| if (MSVC) | ||
| set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use") | ||
| else () | ||
| set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use") | ||
| endif() | ||
| set (CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| if (POLICY CMP0025) | ||
| cmake_policy(SET CMP0025 NEW) | ||
| endif () | ||
| endif () | ||
| set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use") | ||
| endif() | ||
| endmacro(use_cxx11) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,10 @@ 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.") | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would have bailed out in the test code later on before. I moved it up so there is not a stray |
||
| 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") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subsequent calls to raise the required version are allowed