2018-01-25 17:33:52 +01:00
|
|
|
if (BUILD_GUI)
|
2022-10-09 18:51:01 +02:00
|
|
|
list(APPEND qt_components Core Gui Widgets PrintSupport LinguistTools Help Network)
|
2022-02-07 17:35:25 +01:00
|
|
|
if (WITH_QCHART)
|
|
|
|
list(APPEND qt_components Charts)
|
|
|
|
endif()
|
2021-12-17 21:49:32 +01:00
|
|
|
if (BUILD_TESTS)
|
2022-02-07 17:35:25 +01:00
|
|
|
list(APPEND qt_components Test)
|
2019-05-17 10:17:51 +02:00
|
|
|
endif()
|
2022-04-15 18:49:24 +02:00
|
|
|
if (USE_QT6)
|
2023-08-09 22:40:15 +02:00
|
|
|
find_package(Qt6 COMPONENTS ${qt_components} REQUIRED)
|
2022-04-15 18:49:24 +02:00
|
|
|
set(QT_VERSION "${Qt6Core_VERSION_STRING}")
|
|
|
|
if (NOT QT_VERSION)
|
2023-08-09 22:40:15 +02:00
|
|
|
# TODO: how to get the actual version?
|
2022-04-15 18:49:24 +02:00
|
|
|
message(WARNING "'Qt6Core_VERSION_STRING' is not set - using 6.0.0 as fallback")
|
|
|
|
set(QT_VERSION "6.0.0")
|
|
|
|
endif()
|
|
|
|
if (MSVC)
|
|
|
|
# disable Visual Studio C++ memory leak detection since it causes compiler errors with Qt 6
|
|
|
|
# D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): warning C4003: not enough arguments for function-like macro invocation 'free' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj]
|
|
|
|
# D:\a\cppcheck\Qt\6.2.4\msvc2019_64\include\QtCore/qhash.h(179,15): error C2059: syntax error: ',' [D:\a\cppcheck\cppcheck\build\gui\cppcheck-gui.vcxproj]
|
|
|
|
# this is supposed to be fixed according to the following tickets but it still happens
|
|
|
|
# https://bugreports.qt.io/browse/QTBUG-40575
|
|
|
|
# https://bugreports.qt.io/browse/QTBUG-86395
|
|
|
|
set(DISABLE_CRTDBG_MAP_ALLOC ON)
|
|
|
|
endif()
|
2023-08-09 22:40:15 +02:00
|
|
|
else()
|
|
|
|
find_package(Qt5 COMPONENTS ${qt_components} REQUIRED)
|
|
|
|
set(QT_VERSION "${Qt5Core_VERSION_STRING}")
|
2022-04-15 18:49:24 +02:00
|
|
|
endif()
|
2018-01-25 17:33:52 +01:00
|
|
|
endif()
|
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
if (HAVE_RULES)
|
2021-03-30 13:37:26 +02:00
|
|
|
find_path(PCRE_INCLUDE pcre.h)
|
2023-09-12 10:36:35 +02:00
|
|
|
find_library(PCRE_LIBRARY NAMES pcre pcred)
|
2021-03-30 13:37:26 +02:00
|
|
|
if (NOT PCRE_LIBRARY OR NOT PCRE_INCLUDE)
|
2015-02-13 19:00:14 +01:00
|
|
|
message(FATAL_ERROR "pcre dependency for RULES has not been found")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
2015-07-23 10:49:53 +02:00
|
|
|
|
2023-09-27 10:06:03 +02:00
|
|
|
if (CMAKE_VERSION VERSION_EQUAL "3.12" OR CMAKE_VERSION VERSION_GREATER "3.12")
|
|
|
|
find_package(Python COMPONENTS Interpreter)
|
|
|
|
if (NOT Python_Interpreter_FOUND)
|
2022-04-13 20:56:07 +02:00
|
|
|
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
|
|
|
set(USE_MATCHCOMPILER_OPT "Off")
|
2023-09-27 10:06:03 +02:00
|
|
|
else()
|
|
|
|
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_package(PythonInterp 3 QUIET)
|
|
|
|
if (NOT PYTHONINTERP_FOUND)
|
|
|
|
set(PYTHONINTERP_FOUND "")
|
|
|
|
find_package(PythonInterp 2.7 QUIET)
|
|
|
|
if (NOT PYTHONINTERP_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")
|
|
|
|
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
|
|
|
|
set(USE_MATCHCOMPILER_OPT "Off")
|
|
|
|
endif()
|
2015-07-23 10:49:53 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
2020-11-22 08:57:07 +01:00
|
|
|
|
|
|
|
if (NOT USE_BUNDLED_TINYXML2)
|
|
|
|
find_package(tinyxml2 QUIET)
|
2022-03-22 21:41:44 +01:00
|
|
|
if (TARGET tinyxml2::tinyxml2)
|
|
|
|
set(tinyxml2_LIBRARIES "tinyxml2::tinyxml2")
|
2022-09-06 18:30:59 +02:00
|
|
|
set(tinyxml2_INCLUDE_DIRS $<TARGET_PROPERTY:tinyxml2::tinyxml2,INTERFACE_INCLUDE_DIRECTORIES>)
|
2022-03-22 21:41:44 +01:00
|
|
|
else()
|
2022-03-15 21:17:03 +01:00
|
|
|
find_library(tinyxml2_LIBRARIES tinyxml2)
|
2022-09-06 18:30:59 +02:00
|
|
|
find_path(tinyxml2_INCLUDE_DIRS tinyxml2.h)
|
|
|
|
if (NOT tinyxml2_LIBRARIES AND NOT tinyxml2_INCLUDE_DIRS)
|
2020-11-22 08:57:07 +01:00
|
|
|
message(FATAL_ERROR "tinyxml2 has not been found")
|
|
|
|
else()
|
|
|
|
set(tinyxml2_FOUND 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2022-02-23 09:04:35 +01:00
|
|
|
|
2022-07-08 16:42:57 +02:00
|
|
|
find_package(Threads REQUIRED)
|
2022-03-20 10:13:32 +01:00
|
|
|
|
|
|
|
if (USE_BOOST)
|
2022-09-27 18:49:38 +02:00
|
|
|
# we are using the header-only "container" component
|
|
|
|
find_package(Boost QUIET)
|
2022-03-20 10:13:32 +01:00
|
|
|
endif()
|
2022-04-13 20:56:07 +02:00
|
|
|
|
|
|
|
find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
|