Use modern CMake syntax. (#1273)

* Use modern CMake syntax.

* Update way of finding Qt5 components
This commit is contained in:
Susi Lehtola 2018-06-02 19:31:33 +03:00 committed by Daniel Marjamäki
parent 0771a81969
commit f2fc38a5b4
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
project(CppCheck) project(CppCheck)
cmake_minimum_required(VERSION 2.8.4) cmake_minimum_required(VERSION 2.8.11)
include(GNUInstallDirs) include(GNUInstallDirs)

View File

@ -1,6 +1,8 @@
if (BUILD_GUI) if (BUILD_GUI)
set(GUI_QT_COMPONENTS Core Gui Widgets PrintSupport) find_package(Qt5Core)
find_package(Qt5 COMPONENTS ${GUI_QT_COMPONENTS}) find_package(Qt5Gui)
find_package(Qt5Widgets)
find_package(Qt5PrintSupport)
find_package(Qt5LinguistTools) find_package(Qt5LinguistTools)
endif() endif()
@ -21,4 +23,3 @@ if (NOT ${USE_MATCHCOMPILER_OPT} STREQUAL "Off")
set(USE_MATCHCOMPILER_OPT "Off") set(USE_MATCHCOMPILER_OPT "Off")
endif() endif()
endif() endif()

View File

@ -24,7 +24,7 @@ if (BUILD_GUI)
if (HAVE_RULES) if (HAVE_RULES)
target_link_libraries(cppcheck-gui pcre) target_link_libraries(cppcheck-gui pcre)
endif() endif()
qt5_use_modules(cppcheck-gui ${GUI_QT_COMPONENTS}) target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::LinguistTools)
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)