diff options
author | Brad King <brad.king@kitware.com> | 2014-01-29 15:05:04 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-01-29 15:05:04 (GMT) |
commit | bbc82d85e5e721cc705f1d836630c672cd4acf28 (patch) | |
tree | 1b58fadc451dbda03d439eedc9958e25d5173317 /Tests | |
parent | fed6c73e1d21adee7e82d61ec1e08c0eaa184a39 (diff) | |
parent | f7ae1d8ad6d0db2b6656ed77f7de12189badf05c (diff) | |
download | CMake-bbc82d85e5e721cc705f1d836630c672cd4acf28.zip CMake-bbc82d85e5e721cc705f1d836630c672cd4acf28.tar.gz CMake-bbc82d85e5e721cc705f1d836630c672cd4acf28.tar.bz2 |
Merge topic 'fix-Qt-autogen'
f7ae1d8a QtAutogen: Short-circut some logic when moc is not available.
4b989d5f QtAutogen: Separate source file processing from AUTOMOC.
c48d877d QtAutogen: Make some methods appropriately file-static.
394e86df QtAutogen: Fix autouic target options in the presence of a config.
964d7f2a QtAutogen: Remove unused variables.
0d934efd QtAutogen: Remove read of SKIP_AUTOUIC target property.
321e348e QtAutogen: Use Qt 4 IMPORTED targets to find executable locations.
e96683b0 Qt4: Use IMPORTED executable names with custom commands.
e6182f5d Qt4: Create IMPORTED executable targets for all Qt executables.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Qt4And5Automoc/CMakeLists.txt | 15 | ||||
-rw-r--r-- | Tests/Qt4And5Automoc/main.cpp.in (renamed from Tests/Qt4And5Automoc/main.cpp) | 0 | ||||
-rw-r--r-- | Tests/Qt4And5Automoc/main_qt4.cpp | 4 | ||||
-rw-r--r-- | Tests/Qt4And5Automoc/main_qt5.cpp | 4 | ||||
-rw-r--r-- | Tests/QtAutogen/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.cpp | 13 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.h | 20 | ||||
-rw-r--r-- | Tests/QtAutogen/uiconly.ui | 24 |
8 files changed, 84 insertions, 10 deletions
diff --git a/Tests/Qt4And5Automoc/CMakeLists.txt b/Tests/Qt4And5Automoc/CMakeLists.txt index 0cc80fe..61d5743 100644 --- a/Tests/Qt4And5Automoc/CMakeLists.txt +++ b/Tests/Qt4And5Automoc/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 2.8.12) project(Qt4And5Automoc) @@ -7,7 +8,17 @@ find_package(Qt5Core REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_executable(qt4_exe main_qt4.cpp) +macro(generate_main_file VERSION) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/main_qt${VERSION}.cpp" COPYONLY) + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/main_qt${VERSION}.cpp" + "#include \"main_qt${VERSION}.moc\"\n" + ) +endmacro() + +generate_main_file(4) +generate_main_file(5) + +add_executable(qt4_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt4.cpp") target_link_libraries(qt4_exe Qt4::QtCore) -add_executable(qt5_exe main_qt5.cpp) +add_executable(qt5_exe "${CMAKE_CURRENT_BINARY_DIR}/main_qt5.cpp") target_link_libraries(qt5_exe Qt5::Core) diff --git a/Tests/Qt4And5Automoc/main.cpp b/Tests/Qt4And5Automoc/main.cpp.in index 00fd641..00fd641 100644 --- a/Tests/Qt4And5Automoc/main.cpp +++ b/Tests/Qt4And5Automoc/main.cpp.in diff --git a/Tests/Qt4And5Automoc/main_qt4.cpp b/Tests/Qt4And5Automoc/main_qt4.cpp deleted file mode 100644 index a84ce89..0000000 --- a/Tests/Qt4And5Automoc/main_qt4.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include "main.cpp" - -#include "main_qt4.moc" diff --git a/Tests/Qt4And5Automoc/main_qt5.cpp b/Tests/Qt4And5Automoc/main_qt5.cpp deleted file mode 100644 index 287b261..0000000 --- a/Tests/Qt4And5Automoc/main_qt5.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include "main.cpp" - -#include "main_qt5.moc" diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 7b99395..515bf5b 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -11,6 +11,11 @@ if (QT_TEST_VERSION STREQUAL 4) include(UseQt4) set(QT_QTCORE_TARGET Qt4::QtCore) + + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + else() if (NOT QT_TEST_VERSION STREQUAL 5) message(SEND_ERROR "Invalid Qt version specified.") @@ -25,6 +30,11 @@ else() if(Qt5_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() + + macro(qtx_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + endif() @@ -77,3 +87,7 @@ set_target_properties(empty PROPERTIES AUTOMOC TRUE) target_link_libraries(empty no_link_language) add_library(no_link_language STATIC empty.h) set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) + +qtx_wrap_cpp(uicOnlyMoc uiconly.h) +add_executable(uiconly uiconly.cpp ${uicOnlyMoc}) +target_link_libraries(uiconly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/uiconly.cpp b/Tests/QtAutogen/uiconly.cpp new file mode 100644 index 0000000..cdb3318 --- /dev/null +++ b/Tests/QtAutogen/uiconly.cpp @@ -0,0 +1,13 @@ + +#include "uiconly.h" + +UicOnly::UicOnly(QWidget *parent) + : QWidget(parent), ui(new Ui::UicOnly) +{ + +} + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/uiconly.h b/Tests/QtAutogen/uiconly.h new file mode 100644 index 0000000..9e21f82 --- /dev/null +++ b/Tests/QtAutogen/uiconly.h @@ -0,0 +1,20 @@ + +#ifndef UIC_ONLY_H +#define UIC_ONLY_H + +#include <QWidget> +#include <memory> + +#include "ui_uiconly.h" + +class UicOnly : public QWidget +{ + Q_OBJECT +public: + explicit UicOnly(QWidget *parent = 0); + +private: + const std::auto_ptr<Ui::UicOnly> ui; +}; + +#endif diff --git a/Tests/QtAutogen/uiconly.ui b/Tests/QtAutogen/uiconly.ui new file mode 100644 index 0000000..13fb832 --- /dev/null +++ b/Tests/QtAutogen/uiconly.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UicOnly</class> + <widget class="QWidget" name="UicOnly"> + <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="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |