From 64c6c943c7469c60e8d25c3efd630249740ae2f4 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 18 Mar 2019 19:26:24 +0100 Subject: CMake: Add more examples Change-Id: I7a8a3fd0a844a518592957fe07c6e707dd452d5f Reviewed-by: Alexandru Croitor --- .../corelib/serialization/cbordump/CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/corelib/serialization/cbordump/CMakeLists.txt (limited to 'examples/corelib/serialization/cbordump/CMakeLists.txt') diff --git a/examples/corelib/serialization/cbordump/CMakeLists.txt b/examples/corelib/serialization/cbordump/CMakeLists.txt new file mode 100644 index 0000000000..b62181a2b7 --- /dev/null +++ b/examples/corelib/serialization/cbordump/CMakeLists.txt @@ -0,0 +1,19 @@ +# Generated from cbordump.pro. + +##################################################################### +## cbordump Binary: +##################################################################### + +add_qt_executable(cbordump + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump" + SOURCES + main.cpp + LIBRARIES + # Remove: gui +) + +#### Keys ignored in scope 1:.:cbordump.pro:: +# CONFIG = "-app_bundle" +# TEMPLATE = "app" -- cgit v1.2.3 From 99539a289491a2a709c2a63cd91eac155a1699da Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 4 Jun 2019 17:08:47 +0200 Subject: Allow to build examples as standalone project Create CMake config files which can be used from the very same CMake project. These CMake config files simply do not create any targets, controlled via the QT_NO_CREATE_TARGETS. This patch also allows to build qtbase.git:examples as a standalone project, against an already-built Qt. Ran this: ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example Task-number: QTBUG-74713 Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d Reviewed-by: Alexandru Croitor --- .../corelib/serialization/cbordump/CMakeLists.txt | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'examples/corelib/serialization/cbordump/CMakeLists.txt') diff --git a/examples/corelib/serialization/cbordump/CMakeLists.txt b/examples/corelib/serialization/cbordump/CMakeLists.txt index b62181a2b7..f9f6be09d9 100644 --- a/examples/corelib/serialization/cbordump/CMakeLists.txt +++ b/examples/corelib/serialization/cbordump/CMakeLists.txt @@ -1,19 +1,26 @@ # Generated from cbordump.pro. -##################################################################### -## cbordump Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(cbordump LANGUAGES CXX) -add_qt_executable(cbordump - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump" - SOURCES - main.cpp - LIBRARIES - # Remove: gui -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt5 COMPONENTS Core) -#### Keys ignored in scope 1:.:cbordump.pro:: -# CONFIG = "-app_bundle" -# TEMPLATE = "app" +add_executable(cbordump + main.cpp +) +target_link_libraries(cbordump PUBLIC + # Remove: gui + Qt::Core +) +install(TARGETS cbordump + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" +) -- cgit v1.2.3 From efa9998521cb061051fe8b75d0df3206d0b32ec5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Jun 2019 10:21:40 +0200 Subject: Fix compiling of examples on Android * Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE but provide it implicitly. It's redundant :) * When on Android, build a module (shared library), just like qmake. This requires an additional library destination in the install() call, but that's ignored on other platforms. * Fix typos in the android deployment generation settings function * Use the correct cache variable to determine whether we're inside a Qt build or not. Right now this only works inside Qt builds anyway as QtPlatformAndroid.cmake is not publically accessible. Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5 Reviewed-by: Alexandru Croitor Reviewed-by: Qt CMake Build Bot --- examples/corelib/serialization/cbordump/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/corelib/serialization/cbordump/CMakeLists.txt') diff --git a/examples/corelib/serialization/cbordump/CMakeLists.txt b/examples/corelib/serialization/cbordump/CMakeLists.txt index f9f6be09d9..5b924878c4 100644 --- a/examples/corelib/serialization/cbordump/CMakeLists.txt +++ b/examples/corelib/serialization/cbordump/CMakeLists.txt @@ -23,4 +23,5 @@ target_link_libraries(cbordump PUBLIC install(TARGETS cbordump RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) -- cgit v1.2.3