2015-02-13 19:00:14 +01:00
|
|
|
if (BUILD_GUI)
|
|
|
|
|
2022-09-30 07:27:03 +02:00
|
|
|
# disable all clang-tidy checks for Qt generated files
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/.clang-tidy"
|
|
|
|
"---
|
|
|
|
Checks: '-*,misc-definitions-in-headers'
|
|
|
|
WarningsAsErrors: '*'
|
|
|
|
CheckOptions:
|
|
|
|
- { key: HeaderFileExtensions, value: 'x' }
|
|
|
|
")
|
|
|
|
|
2022-07-11 10:46:18 +02:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
2015-02-13 19:00:14 +01:00
|
|
|
add_definitions(-DQT_NO_DEBUG)
|
|
|
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
|
|
|
add_definitions(-DQT_NO_WARNING_OUTPUT)
|
|
|
|
else()
|
|
|
|
add_definitions(-DQT_DEBUG)
|
|
|
|
endif()
|
2016-09-27 07:36:08 +02:00
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
file(GLOB hdrs "*.h")
|
|
|
|
file(GLOB srcs "*.cpp")
|
|
|
|
file(GLOB uis "*.ui")
|
|
|
|
file(GLOB tss "*.ts")
|
2022-02-07 17:35:25 +01:00
|
|
|
QT_WRAP_UI(uis_hdrs ${uis})
|
|
|
|
QT_ADD_RESOURCES(resources "gui.qrc")
|
2022-04-11 11:25:08 +02:00
|
|
|
# TODO: passing "-no-obsolete" here breaks the translations
|
2022-02-16 07:06:59 +01:00
|
|
|
QT_CREATE_TRANSLATION(qms ${CMAKE_CURRENT_SOURCE_DIR} ${tss})
|
|
|
|
list(APPEND cppcheck-gui-deps ${hdrs} ${uis_hdrs} ${resources} ${qms})
|
2021-10-31 20:15:32 +01:00
|
|
|
add_custom_target(gui-build-deps SOURCES ${cppcheck-gui-deps})
|
|
|
|
|
2023-01-26 22:13:07 +01:00
|
|
|
list(APPEND cppcheck-gui_SOURCES ${srcs})
|
|
|
|
if (NOT BUILD_CORE_DLL)
|
|
|
|
list(APPEND cppcheck-gui_SOURCES $<TARGET_OBJECTS:cppcheck-core> $<TARGET_OBJECTS:simplecpp_objs>)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
list(APPEND cppcheck-gui_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
|
|
|
|
endif()
|
2020-11-22 08:57:07 +01:00
|
|
|
endif()
|
2016-09-27 07:36:08 +02:00
|
|
|
|
2021-10-31 20:15:32 +01:00
|
|
|
add_executable(cppcheck-gui ${cppcheck-gui-deps} ${cppcheck-gui_SOURCES})
|
2021-10-30 09:08:07 +02:00
|
|
|
set_target_properties(cppcheck-gui PROPERTIES AUTOMOC ON)
|
|
|
|
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/lib/)
|
|
|
|
if(USE_BUNDLED_TINYXML2)
|
|
|
|
target_include_directories(cppcheck-gui PRIVATE ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
|
2022-09-06 18:30:59 +02:00
|
|
|
else()
|
|
|
|
target_include_directories(cppcheck-gui SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
|
2021-10-30 09:08:07 +02:00
|
|
|
endif()
|
2023-02-08 08:19:21 +01:00
|
|
|
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
|
|
|
|
target_precompile_headers(cppcheck-gui PRIVATE precompiled.h)
|
|
|
|
endif()
|
2015-11-26 20:25:09 +01:00
|
|
|
if (HAVE_RULES)
|
2020-05-27 05:15:46 +02:00
|
|
|
target_link_libraries(cppcheck-gui ${PCRE_LIBRARY})
|
|
|
|
endif()
|
2020-11-22 08:57:07 +01:00
|
|
|
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
|
2022-03-15 21:17:03 +01:00
|
|
|
target_link_libraries(cppcheck-gui ${tinyxml2_LIBRARIES})
|
2020-11-22 08:57:07 +01:00
|
|
|
endif()
|
2022-10-09 18:51:01 +02:00
|
|
|
target_link_libraries(cppcheck-gui ${QT_CORE_LIB} ${QT_GUI_LIB} ${QT_WIDGETS_LIB} ${QT_PRINTSUPPORT_LIB} ${QT_HELP_LIB} ${QT_NETWORK_LIB})
|
2019-05-17 10:17:51 +02:00
|
|
|
if(WITH_QCHART)
|
2022-02-07 17:35:25 +01:00
|
|
|
target_link_libraries(cppcheck-gui ${QT_CHARTS_LIB})
|
2019-05-17 10:17:51 +02:00
|
|
|
endif()
|
2023-01-26 22:13:07 +01:00
|
|
|
if (BUILD_CORE_DLL)
|
|
|
|
target_compile_definitions(cppcheck-gui PRIVATE CPPCHECKLIB_IMPORT TINYXML2_IMPORT)
|
|
|
|
target_link_libraries(cppcheck-gui cppcheck-core)
|
|
|
|
endif()
|
2020-04-21 17:27:51 +02:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2022-03-13 20:07:58 +01:00
|
|
|
# Q_UNUSED() in generated code
|
|
|
|
target_compile_options_safe(cppcheck-gui -Wno-extra-semi-stmt)
|
|
|
|
# caused by Qt generated moc code
|
|
|
|
target_compile_options_safe(cppcheck-gui -Wno-redundant-parens)
|
2020-04-21 17:27:51 +02:00
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2015-11-26 20:25:09 +01:00
|
|
|
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
|
|
|
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
2016-09-27 07:36:08 +02:00
|
|
|
install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
|
|
|
|
|
|
|
# icons
|
2016-09-27 10:13:24 +02:00
|
|
|
install(FILES cppcheck-gui.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
|
2016-09-27 10:10:09 +02:00
|
|
|
install(FILES cppcheck-gui.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/64x64/apps)
|
2016-09-27 07:36:08 +02:00
|
|
|
|
2021-12-17 21:49:32 +01:00
|
|
|
if (BUILD_TESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
endif()
|