CMakeLists: Migrate Qt checking over to using components

Qt has since made their library usable with the components system within
CMake, so we can just use that to simplify the library finding and linking.
This commit is contained in:
Lioncash 2019-08-25 04:55:33 -04:00
parent bc8218e183
commit a016b72ea6
2 changed files with 22 additions and 15 deletions

View File

@ -123,7 +123,7 @@ if(TARGET boo AND NOT WINDOWS_STORE AND NOT NX)
endif() endif()
# Editor # Editor
find_package(Qt5Widgets) find_package(Qt5 COMPONENTS Widgets)
if (Qt5Widgets_FOUND) if (Qt5Widgets_FOUND)
message(STATUS "Qt5 found, amuse-gui will be built") message(STATUS "Qt5 found, amuse-gui will be built")
add_subdirectory(Editor) add_subdirectory(Editor)

View File

@ -2,12 +2,7 @@ cmake_minimum_required(VERSION 3.10)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets REQUIRED) find_package(Qt5 COMPONENTS LinguistTools Network Qml Svg Widgets Xml REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
if(WIN32) if(WIN32)
list(APPEND PLAT_SRCS platforms/win/amuse-gui.rc platforms/win/amuse-gui.manifest) list(APPEND PLAT_SRCS platforms/win/amuse-gui.rc platforms/win/amuse-gui.manifest)
@ -76,12 +71,24 @@ if(COMMAND add_sanitizers)
endif() endif()
set_target_properties(amuse-gui PROPERTIES set_target_properties(amuse-gui PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/platforms/mac/Info.plist"
)
target_link_libraries(amuse-gui ${PLAT_LIBS} target_link_libraries(amuse-gui
${Qt5Widgets_LIBRARIES} ${PLAT_LIBS}
${Qt5Network_LIBRARIES}
${Qt5Xml_LIBRARIES} Qt5::Network
${Qt5Svg_LIBRARIES} Qt5::Qml
${Qt5Qml_LIBRARIES} Qt5::Svg
amuse boo ${BOO_SYS_LIBS} logvisor athena-core xxhash ${ZLIB_LIBRARIES} lzokay) Qt5::Widgets
Qt5::Xml
amuse
athena-core
boo
${BOO_SYS_LIBS}
logvisor
lzokay
xxhash
${ZLIB_LIBRARIES}
)