From fc5176dc3882fe183809bb5060c519641aa2867d Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 11 Jun 2015 23:26:32 +0200 Subject: [PATCH] Refactor cmake scripts, reducing the amount of find_package(Qt4) --- CMakeLists.txt | 2 ++ apps/launcher/CMakeLists.txt | 4 ++-- apps/opencs/CMakeLists.txt | 5 +++-- apps/wizard/CMakeLists.txt | 4 ++-- components/CMakeLists.txt | 12 +++--------- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec69c5560..0a75976d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,8 @@ endif() # Dependencies +find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork) + # Fix for not visible pthreads functions for linker with glibc 2.15 if (UNIX AND NOT APPLE) find_package (Threads) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 0de79f8f6..8be7a20b6 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -57,7 +57,6 @@ set(LAUNCHER_UI source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER}) -find_package(Qt4 REQUIRED) set(QT_USE_QTGUI 1) # Set some platform specific settings @@ -92,7 +91,8 @@ target_link_libraries(openmw-launcher ${OGRE_LIBRARIES} ${OGRE_STATIC_PLUGINS} ${SDL2_LIBRARY_ONLY} - ${QT_LIBRARIES} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} components ) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 37d13223a..044e8c4ee 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -160,7 +160,6 @@ endif(WIN32) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) -find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED) include(${QT_USE_FILE}) qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI}) @@ -208,7 +207,9 @@ target_link_libraries(openmw-cs ${SHINY_LIBRARIES} ${Boost_LIBRARIES} ${BULLET_LIBRARIES} - ${QT_LIBRARIES} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${QT_QTNETWORK_LIBRARY} components ) diff --git a/apps/wizard/CMakeLists.txt b/apps/wizard/CMakeLists.txt index b8cc3fda4..55f326a0c 100644 --- a/apps/wizard/CMakeLists.txt +++ b/apps/wizard/CMakeLists.txt @@ -81,7 +81,6 @@ endif (OPENMW_USE_UNSHIELD) source_group(wizard FILES ${WIZARD} ${WIZARD_HEADER}) -find_package(Qt4 REQUIRED) set(QT_USE_QTGUI 1) # Set some platform specific settings @@ -113,7 +112,8 @@ add_executable(openmw-wizard target_link_libraries(openmw-wizard ${Boost_LIBRARIES} - ${QT_LIBRARIES} + ${QT_QTGUI_LIBRARY} + ${QT_QTCORE_LIBRARY} components ) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 01de1c28e..951a80509 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -126,11 +126,6 @@ add_component_dir (version set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui ) -find_package(Qt4 COMPONENTS QtCore QtGui) -if(MINGW) -find_package(Bullet REQUIRED COMPONENTS Collision) -endif() - if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY) add_component_qt_dir (contentselector model/modelitem model/esmfile @@ -167,16 +162,15 @@ target_link_libraries(components ${Boost_LIBRARIES} ${OGRE_LIBRARIES} ${OENGINE_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY} + ${BULLET_LIBRARIES} ) if (GIT_CHECKOUT) add_dependencies (components git-version) endif (GIT_CHECKOUT) -if(MINGW) -target_link_libraries(components ${QT_LIBRARIES} ${BULLET_LIBRARIES}) -endif() - if (WIN32) target_link_libraries(components shlwapi) endif()