Install CMake config files from Qt.
authorStephen Kelly <stephen.kelly@kdab.com>
Tue, 1 Nov 2011 13:59:23 +0000 (14:59 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 29 Nov 2011 16:08:39 +0000 (17:08 +0100)
This includes a BSD licenced file Qt5CoreMacros.cmake which is
adapted from Qt4Macros.cmake in the CMake source tree.

Change-Id: I54326b808795535490a0489659b351a8da72cdbb
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
21 files changed:
mkspecs/cmake/Qt5BasicConfig.cmake.in [new file with mode: 0644]
mkspecs/cmake/Qt5ConfigVersion.cmake.in [new file with mode: 0644]
mkspecs/features/create_cmake.prf [new file with mode: 0644]
mkspecs/features/qt_module_config.prf
src/corelib/Qt5CoreConfigExtras.cmake.in [new file with mode: 0644]
src/corelib/Qt5CoreMacros.cmake [new file with mode: 0644]
src/gui/Qt5GuiConfigExtras.cmake.in [new file with mode: 0644]
src/modules/qt_widgets.pri
src/widgets/Qt5WidgetsConfigExtras.cmake.in [new file with mode: 0644]
src/widgets/Qt5WidgetsMacros.cmake [new file with mode: 0644]
tests/manual/cmake/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/pass1/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/pass1/three.cpp [new file with mode: 0644]
tests/manual/cmake/pass1/two.cpp [new file with mode: 0644]
tests/manual/cmake/pass2/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/pass2/myobject.cpp [new file with mode: 0644]
tests/manual/cmake/pass2/myobject.h [new file with mode: 0644]
tests/manual/cmake/pass3/CMakeLists.txt [new file with mode: 0644]
tests/manual/cmake/pass3/mywidget.cpp [new file with mode: 0644]
tests/manual/cmake/pass3/mywidget.h [new file with mode: 0644]
tests/manual/cmake/pass3/mywidget.ui [new file with mode: 0644]

diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in
new file mode 100644 (file)
index 0000000..2a49197
--- /dev/null
@@ -0,0 +1,62 @@
+
+get_filename_component(_qt5_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
+
+set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MAJOR "$$eval(QT.$${MODULE}.MAJOR_VERSION)")
+set(Qt5$${CMAKE_MODULE_NAME}_VERSION_MINOR "$$eval(QT.$${MODULE}.MINOR_VERSION)")
+set(Qt5$${CMAKE_MODULE_NAME}_VERSION_PATCH "$$eval(QT.$${MODULE}.PATCH_VERSION)")
+
+set(Qt5$${CMAKE_MODULE_NAME}_LIBRARY Qt5$${CMAKE_MODULE_NAME})
+
+set(Qt5$${CMAKE_MODULE_NAME}_HEADER_DIR \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR\" )
+
+set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS \"${Qt5$${CMAKE_MODULE_NAME}_HEADER_DIR}\" \"${_qt5_install_prefix}/$$CMAKE_INCLUDE_DIR/Qt$${CMAKE_MODULE_NAME}\")
+
+set(Qt5$${CMAKE_MODULE_NAME}_LIBRARY_DIR \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR\")
+
+string(TOUPPER "$${CMAKE_MODULE_NAME}" _CMAKE_MODULE_NAME_UPPER)
+set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -DQT_\${_CMAKE_MODULE_NAME_UPPER}_LIB)
+set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS QT_\${_CMAKE_MODULE_NAME_UPPER}_LIB)
+
+set(_Qt5_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\")
+
+if (NOT \"$${CMAKE_MODULE_EXTRAS}\" STREQUAL \"\")
+    include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
+endif()
+
+if (NOT \"$${CMAKE_MODULE_MACROS}\" STREQUAL \"\")
+    include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}Macros.cmake\")
+endif()
+
+if (NOT _Qt5$${CMAKE_MODULE_NAME}_target)
+    set(_Qt5$${CMAKE_MODULE_NAME}_target 1)
+    add_library(Qt5$${CMAKE_MODULE_NAME} SHARED IMPORTED)
+    if (NOT \"$${CMAKE_BUILD_IS_FRAMEWORK}\" STREQUAL \"\")
+        set_property(TARGET Qt5$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
+    endif()
+endif()
+
+if (NOT \"$${debug_type}\" STREQUAL \"\")
+    set_property(TARGET Qt5$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+    set_target_properties(Qt5$${CMAKE_MODULE_NAME} PROPERTIES
+        IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"$${CMAKE_QT5_MODULE_DEPS}\"
+        IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+    )
+    if (NOT \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" STREQUAL \"\")
+        set_target_properties(Qt5$${CMAKE_MODULE_NAME} PROPERTIES
+            IMPORTED_IMPLIB_DEBUG \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\"
+        )
+    endif()
+endif()
+
+if (NOT \"$${release_type}\" STREQUAL \"\")
+    set_property(TARGET Qt5$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+    set_target_properties(Qt5$${CMAKE_MODULE_NAME} PROPERTIES
+        IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"$${CMAKE_QT5_MODULE_DEPS}\"
+        IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+    )
+    if (NOT \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" STREQUAL \"\")
+        set_target_properties(Qt5$${CMAKE_MODULE_NAME} PROPERTIES
+            IMPORTED_IMPLIB_RELEASE \"${_qt5_install_prefix}/$$CMAKE_LIB_DIR/$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\"
+        )
+    endif()
+endif()
diff --git a/mkspecs/cmake/Qt5ConfigVersion.cmake.in b/mkspecs/cmake/Qt5ConfigVersion.cmake.in
new file mode 100644 (file)
index 0000000..66d4b85
--- /dev/null
@@ -0,0 +1,11 @@
+
+set(PACKAGE_VERSION $$eval(QT.$${MODULE}.VERSION))
+
+if(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if(\"\${PACKAGE_FIND_VERSION}\" STREQUAL \"\${PACKAGE_VERSION}\")
+        set(PACKAGE_VERSION_EXACT TRUE)
+    endif(\"\${PACKAGE_FIND_VERSION}\" STREQUAL \"\${PACKAGE_VERSION}\")
+endif(\"\${PACKAGE_VERSION}\" VERSION_LESS \"\${PACKAGE_FIND_VERSION}\")
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
new file mode 100644 (file)
index 0000000..092a8ea
--- /dev/null
@@ -0,0 +1,100 @@
+
+defineReplace(cmakeModuleName) {
+    _module = $$1
+    _name = $$eval(QT.$${_module}.name)
+    cmake_module_name = $$replace(_name, ^Qt, )
+    return ($$cmake_module_name)
+}
+
+defineReplace(cmakeModuleList) {
+    variable = $$1
+    out =
+    for(v, variable) {
+        out += $$cmakeModuleName($$v)
+    }
+    return ($$join(out, ";"))
+}
+
+CMAKE_MODULE_NAME = $$cmakeModuleName($${MODULE})
+
+CMAKE_MODULE_DEPS = $$cmakeModuleList($$eval(QT.$${MODULE}.depends))
+CMAKE_PARTIAL_MODULE_DEPS = $$replace(CMAKE_MODULE_DEPS, ";", ";Qt5")
+!isEmpty(CMAKE_PARTIAL_MODULE_DEPS):CMAKE_QT5_MODULE_DEPS = "Qt5$${CMAKE_PARTIAL_MODULE_DEPS}"
+
+CMAKE_INCLUDE_DIR = include
+CMAKE_LIBS = $$eval(QT.$${MODULE}.libs)
+CMAKE_LIB_DIR = $$replace(CMAKE_LIBS, ^.*/, )
+CMAKE_BINS = $$eval(QT.$${MODULE}.bins)
+CMAKE_BIN_DIR = $$replace(CMAKE_BINS, ^.*/, )
+
+CMAKE_RELATIVE_INSTALL_DIR = "../../../"
+
+macx {
+    CONFIG(qt_framework, qt_framework|qt_no_framework) {
+        CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.framework/Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
+        CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.framework/Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}
+        CMAKE_BUILD_IS_FRAMEWORK = "true"
+    } else {
+        CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib
+        CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.$$eval(QT.$${MODULE}.VERSION).dylib
+    }
+} else:win32 {
+    CMAKE_LIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
+    CMAKE_LIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).dll
+    CMAKE_IMPLIB_FILE_LOCATION_DEBUG = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}d$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
+    CMAKE_IMPLIB_FILE_LOCATION_RELEASE = Qt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}$$eval(QT.$${MODULE}.MAJOR_VERSION).lib
+} else {
+    CMAKE_LIB_FILE_LOCATION_DEBUG = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION)
+    CMAKE_LIB_FILE_LOCATION_RELEASE = libQt$${CMAKE_MODULE_NAME}$${QT_LIBINFIX}.so.$$eval(QT.$${MODULE}.VERSION)
+}
+
+debug_type =
+release_type =
+
+debug_and_release|debug:debug_type = debug
+debug_and_release|release:release_type = release
+
+INSTALLS += cmake_qt5_module_files
+
+cmake_config_file.input = $$PWD/../cmake/Qt5BasicConfig.cmake.in
+cmake_config_file.output = $$eval(QT.$${MODULE}.libs)/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}Config.cmake
+
+cmake_config_version_file.input = $$PWD/../cmake/Qt5ConfigVersion.cmake.in
+cmake_config_version_file.output = $$eval(QT.$${MODULE}.libs)/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigVersion.cmake
+
+QMAKE_SUBSTITUTES += \
+    cmake_config_file \
+    cmake_config_version_file
+
+cmake_qt5_module_files.files = \
+    $$cmake_config_file.output \
+    $$cmake_config_version_file.output
+
+cmake_extras_file.input = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake.in
+exists($$cmake_extras_file.input) {
+
+    CMAKE_MODULE_EXTRAS = "true"
+    cmake_extras_file.output = $$eval(QT.$${MODULE}.libs)/cmake/Qt5$${CMAKE_MODULE_NAME}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake
+
+    QMAKE_SUBSTITUTES += cmake_extras_file
+
+    cmake_qt5_module_files.files += \
+        $$cmake_extras_file.output
+}
+
+cmake_macros_file = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
+exists($$cmake_macros_file) {
+    CMAKE_MODULE_MACROS = "true"
+    cmake_qt5_module_files.files += $$cmake_macros_file
+
+    CMAKE_MACROS_FILE_SOURCE = $$_PRO_FILE_PWD_/Qt5$${CMAKE_MODULE_NAME}Macros.cmake
+    CMAKE_MACROS_FILE_DESTINATION = $$eval(QT.$${MODULE}.libs)/cmake/Qt5$${CMAKE_MODULE_NAME}
+
+    CMAKE_MACROS_FILE_SOURCE ~= s,[/\\\\],$$QMAKE_DIR_SEP,
+    CMAKE_MACROS_FILE_DESTINATION ~= s,[/\\\\],$$QMAKE_DIR_SEP,
+
+    system($$QMAKE_MKDIR \"$$CMAKE_MACROS_FILE_DESTINATION\")
+    system($$QMAKE_COPY \"$$CMAKE_MACROS_FILE_SOURCE\" \"$$CMAKE_MACROS_FILE_DESTINATION\")
+}
+
+cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
index d769481..3d86127 100644 (file)
@@ -56,6 +56,8 @@ CONFIG          -= fix_output_dirs
 win32|mac:!macx-xcode:CONFIG += debug_and_release
 linux*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
 
+CONFIG += create_cmake
+
 contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
 unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
 contains(QT_CONFIG, largefile):CONFIG += largefile
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
new file mode 100644 (file)
index 0000000..1540694
--- /dev/null
@@ -0,0 +1,11 @@
+
+get_filename_component(_qt5_corelib_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
+
+# Required by default:
+set(QT_QMAKE_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/qmake\")
+set(QT_MOC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/moc\")
+set(QT_RCC_EXECUTABLE \"${_qt5_corelib_install_prefix}/$$CMAKE_BIN_DIR/rcc\")
+
+set(Qt5Core_PLUGIN_TYPES codecs)
+
+set(Qt5_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
new file mode 100644 (file)
index 0000000..867d303
--- /dev/null
@@ -0,0 +1,208 @@
+#=============================================================================
+# Copyright 2005-2011 Kitware, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Kitware, Inc. nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+######################################
+#
+#       Macros for building Qt files
+#
+######################################
+
+include(MacroAddFileDependencies)
+
+MACRO (QT5_EXTRACT_OPTIONS _qt5_files _qt5_options)
+  SET(${_qt5_files})
+  SET(${_qt5_options})
+  SET(_QT5_DOING_OPTIONS FALSE)
+  FOREACH(_currentArg ${ARGN})
+    IF ("${_currentArg}" STREQUAL "OPTIONS")
+      SET(_QT5_DOING_OPTIONS TRUE)
+    ELSE ("${_currentArg}" STREQUAL "OPTIONS")
+      IF(_QT5_DOING_OPTIONS)
+        LIST(APPEND ${_qt5_options} "${_currentArg}")
+      ELSE(_QT5_DOING_OPTIONS)
+        LIST(APPEND ${_qt5_files} "${_currentArg}")
+      ENDIF(_QT5_DOING_OPTIONS)
+    ENDIF ("${_currentArg}" STREQUAL "OPTIONS")
+  ENDFOREACH(_currentArg)
+ENDMACRO (QT5_EXTRACT_OPTIONS)
+
+
+# macro used to create the names of output files preserving relative dirs
+MACRO (QT5_MAKE_OUTPUT_FILE infile prefix ext outfile )
+  STRING(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength)
+  STRING(LENGTH ${infile} _infileLength)
+  SET(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR})
+  IF(_infileLength GREATER _binlength)
+    STRING(SUBSTRING "${infile}" 0 ${_binlength} _checkinfile)
+    IF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+      FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_BINARY_DIR} ${infile})
+    ELSE(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+      FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+    ENDIF(_checkinfile STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+  ELSE(_infileLength GREATER _binlength)
+    FILE(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile})
+  ENDIF(_infileLength GREATER _binlength)
+  IF(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path
+    STRING(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}")
+  ENDIF(WIN32 AND rel MATCHES "^[a-zA-Z]:")
+  SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}")
+  STRING(REPLACE ".." "__" _outfile ${_outfile})
+  GET_FILENAME_COMPONENT(outpath ${_outfile} PATH)
+  GET_FILENAME_COMPONENT(_outfile ${_outfile} NAME_WE)
+  FILE(MAKE_DIRECTORY ${outpath})
+  SET(${outfile} ${outpath}/${prefix}${_outfile}.${ext})
+ENDMACRO (QT5_MAKE_OUTPUT_FILE )
+
+
+MACRO (QT5_GET_MOC_FLAGS _moc_flags)
+  SET(${_moc_flags})
+  GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
+
+  FOREACH(_current ${_inc_DIRS})
+    IF("${_current}" MATCHES "\\.framework/?$")
+      STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
+      SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
+    ELSE("${_current}" MATCHES "\\.framework/?$")
+      SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
+    ENDIF("${_current}" MATCHES "\\.framework/?$")
+  ENDFOREACH(_current ${_inc_DIRS})
+
+  GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
+  FOREACH(_current ${_defines})
+    SET(${_moc_flags} ${${_moc_flags}} "-D${_current}")
+  ENDFOREACH(_current ${_defines})
+
+  IF(Q_WS_WIN)
+    SET(${_moc_flags} ${${_moc_flags}} -DWIN32)
+  ENDIF(Q_WS_WIN)
+
+ENDMACRO(QT5_GET_MOC_FLAGS)
+
+
+# helper macro to set up a moc rule
+MACRO (QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
+  # For Windows, create a parameters file to work around command line length limit
+  IF (WIN32)
+    # Pass the parameters in a file.  Set the working directory to
+    # be that containing the parameters file and reference it by
+    # just the file name.  This is necessary because the moc tool on
+    # MinGW builds does not seem to handle spaces in the path to the
+    # file given with the @ syntax.
+    GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME)
+    GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH)
+    IF(_moc_outfile_dir)
+      SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
+    ENDIF(_moc_outfile_dir)
+    SET (_moc_parameters_file ${outfile}_parameters)
+    SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
+    STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
+    FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}")
+    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+                       COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
+                       DEPENDS ${infile}
+                       ${_moc_working_dir}
+                       VERBATIM)
+  ELSE (WIN32)
+    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+                       COMMAND ${QT_MOC_EXECUTABLE}
+                       ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile}
+                       DEPENDS ${infile})
+  ENDIF (WIN32)
+ENDMACRO (QT5_CREATE_MOC_COMMAND)
+
+
+MACRO (QT5_GENERATE_MOC infile outfile )
+# get include dirs and flags
+   QT5_GET_MOC_FLAGS(moc_flags)
+   GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
+   SET(_outfile "${outfile}")
+   IF(NOT IS_ABSOLUTE "${outfile}")
+     SET(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
+   ENDIF(NOT IS_ABSOLUTE "${outfile}")
+   QT5_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "")
+   SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE)  # dont run automoc on this file
+ENDMACRO (QT5_GENERATE_MOC)
+
+
+# QT5_WRAP_CPP(outfiles inputfile ... )
+
+MACRO (QT5_WRAP_CPP outfiles )
+  # get include dirs
+  QT5_GET_MOC_FLAGS(moc_flags)
+  QT5_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
+
+  FOREACH (it ${moc_files})
+    GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
+    QT5_MAKE_OUTPUT_FILE(${it} moc_ cxx outfile)
+    QT5_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
+    SET(${outfiles} ${${outfiles}} ${outfile})
+  ENDFOREACH(it)
+
+ENDMACRO (QT5_WRAP_CPP)
+
+
+# QT5_ADD_RESOURCES(outfiles inputfile ... )
+
+MACRO (QT5_ADD_RESOURCES outfiles )
+  QT5_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
+
+  FOREACH (it ${rcc_files})
+    GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
+    GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+    GET_FILENAME_COMPONENT(rc_path ${infile} PATH)
+    SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
+    #  parse file for dependencies
+    #  all files are absolute paths or relative to the location of the qrc file
+    FILE(READ "${infile}" _RC_FILE_CONTENTS)
+    STRING(REGEX MATCHALL "<file[^<]+" _RC_FILES "${_RC_FILE_CONTENTS}")
+    SET(_RC_DEPENDS)
+    FOREACH(_RC_FILE ${_RC_FILES})
+      STRING(REGEX REPLACE "^<file[^>]*>" "" _RC_FILE "${_RC_FILE}")
+      IF(NOT IS_ABSOLUTE "${_RC_FILE}")
+        SET(_RC_FILE "${rc_path}/${_RC_FILE}")
+      ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}")
+      SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}")
+    ENDFOREACH(_RC_FILE)
+    # Since this cmake macro is doing the dependency scanning for these files,
+    # let's make a configured file and add it as a dependency so cmake is run
+    # again when dependencies need to be recomputed.
+    QT5_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
+    CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY)
+    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+      COMMAND ${QT_RCC_EXECUTABLE}
+      ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile}
+      MAIN_DEPENDENCY ${infile}
+      DEPENDS ${_RC_DEPENDS} "${out_depends}")
+    SET(${outfiles} ${${outfiles}} ${outfile})
+  ENDFOREACH (it)
+
+ENDMACRO (QT5_ADD_RESOURCES)
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
new file mode 100644 (file)
index 0000000..8ddfd45
--- /dev/null
@@ -0,0 +1,4 @@
+
+set(Qt5Gui_PLUGIN_TYPES imageformats)
+
+set(Qt5_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qtiff)
index d3ce0da..9e42fda 100644 (file)
@@ -4,6 +4,7 @@ QT.widgets.MINOR_VERSION = 0
 QT.widgets.PATCH_VERSION = 0
 
 QT.widgets.name = QtWidgets
+QT.widgets.bins = $$QT_MODULE_BIN_BASE
 QT.widgets.includes = $$QT_MODULE_INCLUDE_BASE/QtWidgets
 QT.widgets.private_includes = $$QT_MODULE_INCLUDE_BASE/QtWidgets/$$QT.widgets.VERSION
 QT.widgets.sources = $$QT_MODULE_BASE/src/widgets
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
new file mode 100644 (file)
index 0000000..b7e4594
--- /dev/null
@@ -0,0 +1,5 @@
+
+get_filename_component(_qt5_widgets_install_prefix ${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR} ABSOLUTE)
+
+# Not Required by default:
+set(QT_UIC_EXECUTABLE \"${_qt5_widgets_install_prefix}/$$CMAKE_BIN_DIR/uic\")
diff --git a/src/widgets/Qt5WidgetsMacros.cmake b/src/widgets/Qt5WidgetsMacros.cmake
new file mode 100644 (file)
index 0000000..cf9682f
--- /dev/null
@@ -0,0 +1,75 @@
+#=============================================================================
+# Copyright 2005-2011 Kitware, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Kitware, Inc. nor the names of its
+#   contributors may be used to endorse or promote products derived
+#   from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+######################################
+#
+#       Macros for building Qt files
+#
+######################################
+
+include(MacroAddFileDependencies)
+
+MACRO (QT5_EXTRACT_OPTIONS _qt5_files _qt5_options)
+  SET(${_qt5_files})
+  SET(${_qt5_options})
+  SET(_QT5_DOING_OPTIONS FALSE)
+  FOREACH(_currentArg ${ARGN})
+    IF ("${_currentArg}" STREQUAL "OPTIONS")
+      SET(_QT5_DOING_OPTIONS TRUE)
+    ELSE ("${_currentArg}" STREQUAL "OPTIONS")
+      IF(_QT5_DOING_OPTIONS)
+        LIST(APPEND ${_qt5_options} "${_currentArg}")
+      ELSE(_QT5_DOING_OPTIONS)
+        LIST(APPEND ${_qt5_files} "${_currentArg}")
+      ENDIF(_QT5_DOING_OPTIONS)
+    ENDIF ("${_currentArg}" STREQUAL "OPTIONS")
+  ENDFOREACH(_currentArg)
+ENDMACRO (QT5_EXTRACT_OPTIONS)
+
+
+# QT5_WRAP_UI(outfiles inputfile ... )
+
+MACRO (QT5_WRAP_UI outfiles )
+  QT5_EXTRACT_OPTIONS(ui_files ui_options ${ARGN})
+
+  FOREACH (it ${ui_files})
+    GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
+    GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
+    SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
+    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
+      COMMAND ${QT_UIC_EXECUTABLE}
+      ARGS ${ui_options} -o ${outfile} ${infile}
+      MAIN_DEPENDENCY ${infile})
+    SET(${outfiles} ${${outfiles}} ${outfile})
+  ENDFOREACH (it)
+
+ENDMACRO (QT5_WRAP_UI)
diff --git a/tests/manual/cmake/CMakeLists.txt b/tests/manual/cmake/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b6d5f31
--- /dev/null
@@ -0,0 +1,31 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(qmake_cmake_files)
+
+macro(_do_build _dir)
+    try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/${_dir}
+        ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}
+        ${_dir}
+        OUTPUT_VARIABLE Out
+    )
+endmacro()
+
+macro(expect_pass _dir)
+    _do_build(${_dir})
+    if (NOT Result)
+        message(SEND_ERROR "Build failed: ${Out}")
+    endif()
+endmacro()
+
+macro(expect_fail _dir)
+    _do_build(${_dir})
+    if (Result)
+        message(SEND_ERROR "Build should fail, but did not: ${Out}")
+    endif()
+endmacro()
+
+# Requires a patched cmake for the automoc stuff. Will uncomment when it is released.
+# expect_pass(pass1)
+expect_pass(pass2)
+expect_pass(pass3)
diff --git a/tests/manual/cmake/pass1/CMakeLists.txt b/tests/manual/cmake/pass1/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3ccca1e
--- /dev/null
@@ -0,0 +1,31 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+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_INCLUDE_CURRENT_DIR ON)
+
+macro(qt5_use_package _target _package)
+    # TODO: Handle public/private keywords?
+    find_package(Qt5${_package} ${ARG1})
+    if (Qt5${_package}_FOUND)
+        target_link_libraries(${_target} ${Qt5${_package}_LIBRARY})
+        include_directories(${Qt5${_package}_INCLUDE_DIRS})
+        # set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_package}_INCLUDE_DIRS})
+        set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_package}_COMPILE_DEFINITIONS})
+        foreach(_dep ${_Qt5_MODULE_DEPENDENCIES})
+            qt5_use_package(${_target} ${_dep} REQUIRED)
+        endforeach()
+    endif()
+endmacro()
+
+add_executable(two two.cpp)
+add_executable(three three.cpp)
+
+qt5_use_package(two Test)
+qt5_use_package(three Widgets)
+qt5_use_package(three Test)
diff --git a/tests/manual/cmake/pass1/three.cpp b/tests/manual/cmake/pass1/three.cpp
new file mode 100644 (file)
index 0000000..41ba30b
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <QWidget>
+
+class Three : public QObject
+{
+    Q_OBJECT
+public:
+    Three(QObject *parent = 0)
+    {
+        QWidget *w = new QWidget;
+        w->show();
+    }
+};
+
+QTEST_MAIN(Three)
+
+#include "three.moc"
diff --git a/tests/manual/cmake/pass1/two.cpp b/tests/manual/cmake/pass1/two.cpp
new file mode 100644 (file)
index 0000000..6f7d9bf
--- /dev/null
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+
+class Two : public QObject
+{
+    Q_OBJECT
+public:
+    Two(QObject *parent = 0)
+    {
+
+    }
+};
+
+QTEST_MAIN(Two)
+
+#include "two.moc"
diff --git a/tests/manual/cmake/pass2/CMakeLists.txt b/tests/manual/cmake/pass2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..68be458
--- /dev/null
@@ -0,0 +1,11 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+find_package(Qt5Core REQUIRED)
+
+include_directories(${Qt5Core_INCLUDE_DIRS})
+
+qt5_wrap_cpp(moc_files myobject.h)
+
+add_executable(myobject myobject.cpp ${moc_files})
+target_link_libraries(myobject ${Qt5Core_LIBRARY})
diff --git a/tests/manual/cmake/pass2/myobject.cpp b/tests/manual/cmake/pass2/myobject.cpp
new file mode 100644 (file)
index 0000000..251239c
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "myobject.h"
+
+MyObject::MyObject(QObject *parent)
+    : QObject(parent)
+{
+    emit someSignal();
+}
+
+int main(int argc, char **argv)
+{
+    MyObject myObject;
+    return 0;
+}
diff --git a/tests/manual/cmake/pass2/myobject.h b/tests/manual/cmake/pass2/myobject.h
new file mode 100644 (file)
index 0000000..e2e908d
--- /dev/null
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
+
+#include <QObject>
+
+class MyObject : public QObject
+{
+    Q_OBJECT
+public:
+    MyObject(QObject *parent = 0);
+
+signals:
+    void someSignal();
+};
+
+#endif
diff --git a/tests/manual/cmake/pass3/CMakeLists.txt b/tests/manual/cmake/pass3/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b5ee3cd
--- /dev/null
@@ -0,0 +1,16 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+find_package(Qt5Core REQUIRED)
+find_package(Qt5Gui REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+
+include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+qt5_wrap_cpp(moc_files mywidget.h)
+qt5_wrap_ui(ui_files mywidget.ui)
+
+add_executable(mywidget mywidget.cpp ${moc_files} ${ui_files})
+target_link_libraries(mywidget ${Qt5Core_LIBRARY} ${Qt5Gui_LIBRARY} ${Qt5Widgets_LIBRARY})
diff --git a/tests/manual/cmake/pass3/mywidget.cpp b/tests/manual/cmake/pass3/mywidget.cpp
new file mode 100644 (file)
index 0000000..75804f9
--- /dev/null
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mywidget.h"
+#include "ui_mywidget.h"
+
+MyWidget::MyWidget(QWidget *parent)
+    : QWidget(parent)
+{
+    emit someSignal();
+}
+
+int main(int argc, char **argv)
+{
+    MyWidget myWidget;
+    return 0;
+}
diff --git a/tests/manual/cmake/pass3/mywidget.h b/tests/manual/cmake/pass3/mywidget.h
new file mode 100644 (file)
index 0000000..0f59d38
--- /dev/null
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYWIDGET_H
+#define MYWIDGET_H
+
+#include <QWidget>
+
+namespace Ui
+{
+class MyWidget;
+}
+
+class MyWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    MyWidget(QWidget *parent = 0);
+
+signals:
+    void someSignal();
+
+private:
+    Ui::MyWidget *ui;
+};
+
+#endif
diff --git a/tests/manual/cmake/pass3/mywidget.ui b/tests/manual/cmake/pass3/mywidget.ui
new file mode 100644 (file)
index 0000000..ac42ac4
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QPushButton" name="pushButton">
+     <property name="text">
+      <string>PushButton</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLineEdit" name="lineEdit"/>
+   </item>
+   <item>
+    <widget class="QTextEdit" name="textEdit"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>