Test that the CMAKE_AUTOMOC feature works with Qt5.

Update the wrapper macro which had bitrotted a bit.

Change-Id: I65c7940f9ebc0e1c963fddd2bbfc06b89e66df04
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 06:08:09 +01:00 committed by Qt by Nokia
parent b409a81da5
commit e22431d719
2 changed files with 12 additions and 10 deletions

View File

@ -25,8 +25,10 @@ macro(expect_fail _dir)
endif() endif()
endmacro() endmacro()
# Requires a patched cmake for the automoc stuff. Will uncomment when it is released. if(${CMAKE_VERSION} VERSION_GREATER 2.8.7)
# expect_pass(pass1) # Requires CMAKE_AUTOMOC function in CMake 2.8.7
expect_pass(pass1)
endif()
expect_pass(pass2) expect_pass(pass2)
expect_pass(pass3) expect_pass(pass3)
expect_fail(fail4) expect_fail(fail4)

View File

@ -3,23 +3,23 @@ cmake_minimum_required(VERSION 2.8)
project(pass1) project(pass1)
# Warning: requires cmake 2.8.7 due for release in December 2011
# for automatic moc with Qt 5
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
macro(qt5_use_package _target _package) macro(qt5_use_package _target _package)
# TODO: Handle public/private keywords? if (NOT Qt5${_package}_FOUND)
find_package(Qt5${_package} ${ARG1}) find_package(Qt5${_package} ${ARG1})
endif()
if (Qt5${_package}_FOUND) if (Qt5${_package}_FOUND)
# TODO: Handle public/private keywords?
target_link_libraries(${_target} ${Qt5${_package}_LIBRARIES}) target_link_libraries(${_target} ${Qt5${_package}_LIBRARIES})
include_directories(${Qt5${_package}_INCLUDE_DIRS}) # ### Requires CMake 2.8.8:
# set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_package}_INCLUDE_DIRS}) # set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_package}_INCLUDE_DIRS})
include_directories(${Qt5${_package}_INCLUDE_DIRS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_package}_COMPILE_DEFINITIONS}) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_package}_COMPILE_DEFINITIONS})
foreach(_dep ${_Qt5_MODULE_DEPENDENCIES}) else()
qt5_use_package(${_target} ${_dep} REQUIRED) message(FATAL_ERROR "NOT FOUND: Qt5${_package}")
endforeach()
endif() endif()
endmacro() endmacro()