2015-02-13 19:00:14 +01:00
|
|
|
# Build type
|
|
|
|
#------------------------------------------------------
|
2015-11-26 21:16:59 +01:00
|
|
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRel" CACHE STRING "Configs" FORCE)
|
2015-02-13 19:00:14 +01:00
|
|
|
if(DEFINED CMAKE_BUILD_TYPE)
|
|
|
|
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# PROJECT CONFIGURATION
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
option(ANALYZE_MEMORY "Clang dynamic analyzer: detector of uninitialized reads." OFF)
|
|
|
|
option(ANALYZE_ADDRESS "Clang dynamic analyzer: fast memory error detector. " OFF)
|
|
|
|
option(ANALYZE_THREAD "Clang dynamic analyzer: tool that detects data races. " OFF)
|
|
|
|
option(ANALYZE_UNDEFINED "Clang dynamic analyzer: undefined behavior checker. " OFF)
|
|
|
|
option(ANALYZE_DATAFLOW "Clang dynamic analyzer: general dynamic dataflow analysis." OFF)
|
|
|
|
option(WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF)
|
|
|
|
|
2019-01-06 17:15:57 +01:00
|
|
|
set(USE_MATCHCOMPILER "Auto" CACHE STRING "Usage of match compiler")
|
2015-07-23 10:49:53 +02:00
|
|
|
set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS Auto Off On Verify)
|
2022-07-11 10:46:18 +02:00
|
|
|
if (USE_MATCHCOMPILER STREQUAL "Auto")
|
|
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2015-07-23 10:49:53 +02:00
|
|
|
set(USE_MATCHCOMPILER_OPT "On")
|
|
|
|
else()
|
|
|
|
set(USE_MATCHCOMPILER_OPT "Off")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(USE_MATCHCOMPILER_OPT ${USE_MATCHCOMPILER})
|
|
|
|
endif()
|
|
|
|
|
2023-01-26 22:13:07 +01:00
|
|
|
option(BUILD_CORE_DLL "Build lib as cppcheck-core.dll with Visual Studio" OFF)
|
|
|
|
if (NOT MSVC)
|
|
|
|
set(BUILD_CORE_DLL OFF)
|
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
option(BUILD_TESTS "Build tests" OFF)
|
2020-11-02 20:16:15 +01:00
|
|
|
option(REGISTER_TESTS "Register tests in CTest" ON)
|
2020-03-01 17:11:20 +01:00
|
|
|
option(ENABLE_CHECK_INTERNAL "Enable internal checks" OFF)
|
2023-04-01 09:40:10 +02:00
|
|
|
option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF)
|
2022-04-15 18:49:24 +02:00
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
option(BUILD_GUI "Build the qt application" OFF)
|
2022-04-15 18:49:24 +02:00
|
|
|
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)
|
2022-04-19 10:12:31 +02:00
|
|
|
option(USE_QT6 "Prefer Qt6 when available" OFF)
|
2023-01-27 19:43:08 +01:00
|
|
|
option(REGISTER_GUI_TESTS "Register GUI tests in CTest" ON)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
|
|
|
option(HAVE_RULES "Usage of rules (needs PCRE library and headers)" OFF)
|
2020-11-22 08:57:07 +01:00
|
|
|
option(USE_BUNDLED_TINYXML2 "Usage of bundled tinyxml2 library" ON)
|
2023-01-26 22:13:07 +01:00
|
|
|
if (BUILD_CORE_DLL)
|
|
|
|
set(USE_BUNDLED_TINYXML2 ON)
|
|
|
|
endif()
|
2022-12-07 09:20:09 +01:00
|
|
|
option(CPPCHK_GLIBCXX_DEBUG "Usage of STL debug checks in Debug build" ON)
|
2022-02-23 09:04:35 +01:00
|
|
|
option(USE_THREADS "Usage of threads instead of fork() for -j" OFF)
|
2022-03-20 10:13:32 +01:00
|
|
|
option(USE_BOOST "Usage of Boost" OFF)
|
2022-12-07 09:20:09 +01:00
|
|
|
option(USE_LIBCXX "Use libc++ instead of libstdc++" OFF)
|
2022-08-20 20:54:31 +02:00
|
|
|
|
2022-04-15 18:49:24 +02:00
|
|
|
option(DISABLE_CRTDBG_MAP_ALLOC "Disable usage of Visual Studio C++ memory leak detection in Debug build" OFF)
|
2022-08-20 20:54:31 +02:00
|
|
|
option(NO_UNIX_SIGNAL_HANDLING "Disable usage of Unix Signal Handling" OFF)
|
|
|
|
option(NO_UNIX_BACKTRACE_SUPPORT "Disable usage of Unix Backtrace support" OFF)
|
|
|
|
option(NO_WINDOWS_SEH "Disable usage of Windows SEH" OFF)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2020-12-27 09:17:57 +01:00
|
|
|
if (CMAKE_VERSION VERSION_EQUAL "3.16" OR CMAKE_VERSION VERSION_GREATER "3.16")
|
|
|
|
set(CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers")
|
|
|
|
# need to disable the prologue or it will be treated like a system header and not emit any warnings
|
|
|
|
# see https://gitlab.kitware.com/cmake/cmake/-/issues/21219
|
|
|
|
set(CMAKE_PCH_PROLOGUE "")
|
|
|
|
else()
|
2020-06-25 01:41:16 +02:00
|
|
|
set(CMAKE_DISABLE_PRECOMPILE_HEADERS On CACHE BOOL "Disable precompiled headers")
|
2020-12-27 09:17:57 +01:00
|
|
|
endif()
|
2020-06-25 01:41:16 +02:00
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
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")
|
|
|
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
2019-01-01 22:48:07 +01:00
|
|
|
|
2019-08-17 10:53:07 +02:00
|
|
|
set(FILESDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "Cppcheck files directory")
|
2019-01-01 22:48:07 +01:00
|
|
|
|