File: CMakeLists.txt

package info (click to toggle)
cppcheck 2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,588 kB
  • sloc: cpp: 234,959; ansic: 24,957; python: 9,538; xml: 949; sh: 855; makefile: 657; cs: 291
file content (62 lines) | stat: -rw-r--r-- 2,336 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
if (BUILD_GUI)

    set(CMAKE_AUTOMOC ON)
    if (CMAKE_BUILD_TYPE MATCHES "Release")
        add_definitions(-DQT_NO_DEBUG)
        add_definitions(-DQT_NO_DEBUG_OUTPUT)
        add_definitions(-DQT_NO_WARNING_OUTPUT)
    else()
        add_definitions(-DQT_DEBUG)
    endif()

    include_directories(${PROJECT_SOURCE_DIR}/lib/)
    if(USE_BUNDLED_TINYXML2)
        include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml2/)
    endif()

    file(GLOB hdrs "*.h")
    file(GLOB srcs "*.cpp")
    file(GLOB uis  "*.ui")
    file(GLOB tss  "*.ts")
    QT5_WRAP_UI(uis_hdrs ${uis})
    QT5_ADD_RESOURCES(resources "gui.qrc")
    QT5_ADD_TRANSLATION(qms ${tss})
    list(APPEND cppcheck-gui_SOURCES ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
    if(USE_BUNDLED_TINYXML2)
        list(APPEND cppcheck-gui_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
    endif()

    add_executable(cppcheck-gui ${cppcheck-gui_SOURCES})
    if (HAVE_RULES)
        target_link_libraries(cppcheck-gui ${PCRE_LIBRARY})
    endif()
    if (USE_Z3)
        target_link_libraries(cppcheck-gui ${Z3_LIBRARIES})
    endif()
    if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
        target_link_libraries(cppcheck-gui tinyxml2)
    endif()
    target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Help)
    if(WITH_QCHART)
        target_compile_definitions (cppcheck-gui PRIVATE HAVE_QCHART )
        target_link_libraries(cppcheck-gui Qt5::Charts)
    endif()
    if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
        if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
            # Q_UNUSED() in generated code
            target_compile_options(cppcheck-gui PRIVATE -Wno-extra-semi-stmt)
        endif()
    endif()

    install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
    install(FILES ${qms} DESTINATION ${FILESDIR}/lang COMPONENT applications)

    install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)

    # icons
    install(FILES cppcheck-gui.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
    install(FILES cppcheck-gui.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/64x64/apps)

    set(CMAKE_AUTOMOC OFF)

endif()