Make modules find their own dependencies.

Change-Id: I4a7b96d33417a15d79f3932ced91bee58915c83f
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Stephen Kelly 2012-01-10 05:30:31 +01:00 committed by Qt by Nokia
parent 657038ca30
commit 008a1573af
2 changed files with 14 additions and 3 deletions

View File

@ -14,6 +14,18 @@ set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS QT_\${_CMAKE_MODULE_NAME_UPPER}
set(_Qt5_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") set(_Qt5_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\")
foreach(_module_dep ${_Qt5_MODULE_DEPENDENCIES})
if (NOT Qt5${_module_dep}_FOUND)
find_package(Qt5${_module_dep} REQUIRED)
endif()
list(APPEND Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${Qt5${_module_dep}_INCLUDE_DIRS})
list(APPEND Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
list(APPEND Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
endforeach()
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS)
if (NOT _Qt5$${CMAKE_MODULE_NAME}_target) if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
set(_Qt5$${CMAKE_MODULE_NAME}_target 1) set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
if (\"$${CMAKE_STATIC_TYPE}\" STREQUAL \"\") if (\"$${CMAKE_STATIC_TYPE}\" STREQUAL \"\")

View File

@ -3,11 +3,10 @@ cmake_minimum_required(VERSION 2.8)
project(pass3) project(pass3)
find_package(Qt5Core REQUIRED) # The module finds its dependencies
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)