### End Example Build Configuration Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/CMakeLists.txt Finalizes the build system configuration for Qt examples. ```cmake qt_examples_build_end() ``` -------------------------------- ### Begin Example Build Configuration Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/CMakeLists.txt Initializes the build system for Qt examples, supporting external builds. ```cmake # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause qt_examples_build_begin(EXTERNAL_BUILD) ``` -------------------------------- ### Install Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/simpleswitch/directconnectclient/CMakeLists.txt Configures the installation of the 'directconnectclient' executable, specifying the destination directory based on the defined INSTALL_EXAMPLEDIR. ```cmake install(TARGETS directconnectclient RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) ``` -------------------------------- ### Set Standard Project Properties Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Applies standard Qt project setup configurations. ```cmake qt_standard_project_setup() ``` -------------------------------- ### Configure ModelViewServer Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/modelviewserver/CMakeLists.txt Defines the executable name and links it with required Qt6 modules. Ensures the executable is installed correctly for runtime. ```cmake cmake_minimum_required(VERSION 3.16) project(modelviewserver LANGUAGES CXX) set(CMAKE_AUTOMOC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/remoteobjects/modelviewserver") find_package(Qt6 REQUIRED COMPONENTS Core Gui RemoteObjects Widgets) qt_add_executable(modelviewserver main.cpp ) set_target_properties(modelviewserver PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) target_link_libraries(modelviewserver PUBLIC Qt::Core Qt::Gui Qt::RemoteObjects Qt::Widgets ) install(TARGETS modelviewserver RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) ``` -------------------------------- ### Generate Replicas for differentSignalCount with CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/differentSignalCount/CMakeLists.txt Uses the qt6_add_repc_replicas command to generate the necessary replica code for the differentSignalCount example based on the mismatch.rep file. ```cmake qt6_add_repc_replicas(differentSignalCount mismatch.rep ) ``` -------------------------------- ### Configure Qt Remote Objects ModelViewClient Build Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/modelviewclient/CMakeLists.txt This CMake script sets up the build environment for the modelviewclient example. It finds the necessary Qt6 components, defines the executable, and links the required libraries. ```cmake cmake_minimum_required(VERSION 3.16) project(modelviewclient LANGUAGES CXX) set(CMAKE_AUTOMOC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/remoteobjects/modelviewclient") find_package(Qt6 REQUIRED COMPONENTS Core Gui RemoteObjects Widgets) qt_add_executable(modelviewclient main.cpp ) set_target_properties(modelviewclient PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE FALSE ) target_link_libraries(modelviewclient PUBLIC Qt::Core Qt::Gui Qt::RemoteObjects Qt::Widgets ) install(TARGETS modelviewclient RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) ``` -------------------------------- ### Configure matchAndQuit Executable with CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/matchAndQuit/CMakeLists.txt Defines the matchAndQuit executable using CMake, specifying sources, include directories, and libraries. This is used to build the example application. ```cmake qt_internal_add_executable(matchAndQuit OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Configure differentSignalCount Executable with CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/differentSignalCount/CMakeLists.txt Defines the executable for the differentSignalCount example, specifying sources, include directories, and linking against Qt Remote Objects and Qt Test libraries. ```cmake qt_internal_add_executable(differentSignalCount OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../mismatch.cpp INCLUDE_DIRECTORIES .. LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Find Qt Remote Objects Package Source: https://github.com/qt/qtremoteobjects/blob/dev/src/remoteobjects/doc/snippets/cmake-macros/CMakeLists.txt Finds the necessary Qt6 RemoteObjects component. Ensure Qt6 is installed and configured correctly. ```cmake find_package(Qt6 REQUIRED COMPONENTS RemoteObjects) ``` -------------------------------- ### Generate Merged Sources from .rep File Source: https://github.com/qt/qtremoteobjects/blob/dev/src/remoteobjects/doc/snippets/cmake-macros/CMakeLists.txt Generates both server and replica C++ source files from a single .rep interface definition file for a target. This is useful for examples or applications where both server and client logic might be in the same executable. ```cmake qt6_add_repc_merged(directconnectexample simpleswitch.rep ) ``` -------------------------------- ### Configure Project and Find Qt Modules Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/simpleswitch/directconnectclient/CMakeLists.txt Sets up the minimum CMake version, project name, and language. It then finds the necessary Qt6 modules, specifically Core and RemoteObjects, required for the project. ```cmake cmake_minimum_required(VERSION 3.16) project(directconnectclient LANGUAGES CXX) if (ANDROID) message(FATAL_ERROR "This project cannot be built on Android.") endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/remoteobjects/simpleswitch/directconnectclient") find_package(Qt6 REQUIRED COMPONENTS Core RemoteObjects) ``` -------------------------------- ### Generate Replicas Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/simpleswitch/directconnectclient/CMakeLists.txt Uses the qt6_add_repc_replicas command to generate necessary C++ code from the simpleswitch.rep file, which defines the data model for remote objects. ```cmake qt6_add_repc_replicas(directconnectclient simpleswitch.rep ) ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/simpleswitch/directconnectclient/CMakeLists.txt Defines the main executable target 'directconnectclient' using source files and links the required Qt modules (Core and RemoteObjects) to it. ```cmake qt_add_executable(directconnectclient client.cpp client.h main.cpp ) set_target_properties(directconnectclient PROPERTIES WIN32_EXECUTABLE FALSE MACOSX_BUNDLE FALSE ) target_link_libraries(directconnectclient PUBLIC Qt::Core Qt::RemoteObjects ) ``` -------------------------------- ### Add Replicas for restart_client Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/restart/client/CMakeLists.txt Processes .rep files to generate C++ code for Qt Remote Objects replicas. This command is used to integrate replica definitions into the build system for the restart_client. ```cmake qt6_add_repc_replicas(restart_client ../subclass.rep ) ``` -------------------------------- ### Define Certificate Resource Files Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Lists the certificate and key files required for SSL communication. ```cmake set(cert_resource_files "../sslserver/cert/client.crt" "../sslserver/cert/client.key" "../sslserver/cert/rootCA.key" "../sslserver/cert/rootCA.pem" "../sslserver/cert/rootCA.srl" ) ``` -------------------------------- ### Generate REPC Replicas with CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/matchAndQuit/CMakeLists.txt Generates REPC (Remote Procedure Call) replicas for the matchAndQuit executable using the qt6_add_repc_replicas CMake function. This integrates the .rep file into the build process. ```cmake qt6_add_repc_replicas(matchAndQuit ../server.rep ) ``` -------------------------------- ### Add SSL Certificate Resources Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Integrates SSL certificate files into the client executable as resources, making them accessible at runtime. ```cmake qt6_add_resources(sslcppclient "cert" PREFIX "/sslcert" BASE "../sslserver/cert" FILES ${cert_resource_files} ) ``` -------------------------------- ### Add Executable for restart_client Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/restart/client/CMakeLists.txt Defines the restart_client executable, specifying its source files, output directory, include directories, and linked libraries. This is essential for building the client application. ```cmake qt_internal_add_executable(restart_client OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Add Executable for Proxy Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/proxy_multiprocess/proxy/CMakeLists.txt Defines the proxy executable, its output directory, source files, include directories, and required libraries. ```cmake # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## proxy Binary: ##################################################################### qt_internal_add_executable(proxy OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Link Libraries to Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Links the necessary Qt libraries (Core and RemoteObjects) to the client executable. ```cmake target_link_libraries(sslcppclient PRIVATE Qt::Core Qt::RemoteObjects ) ``` -------------------------------- ### Configure Reconnect Server Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/reconnect/server/CMakeLists.txt Defines the build target for the reconnect server executable. It specifies the output directory, source files, include directories, and links against the Qt Remote Objects and Qt Test libraries. ```cmake # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause qt_internal_add_executable(qtro_reconnect_server OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES main.cpp INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Add Replica Generation Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Generates C++ code for remote object replicas based on the provided .rep file. ```cmake qt6_add_repc_replicas(sslcppclient ../../timemodel.rep ) ``` -------------------------------- ### Configure CMake for Qt Remote Objects Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/cmake/test_cmake_macros/CMakeLists.txt This snippet shows the basic CMake configuration required to use Qt Remote Objects. It includes finding the package, defining the executable, generating replicas from a .rep file, and linking against the Qt::RemoteObjects library. ```cmake cmake_minimum_required(VERSION 3.16) project(test_qremoteobjects_module) find_package(Qt6RemoteObjects REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(MAIN_SRCS main.cpp) add_executable(mainapp ${MAIN_SRCS}) qt6_add_repc_replicas(mainapp ../../integration/pod.rep) target_link_libraries(mainapp Qt::RemoteObjects) ``` -------------------------------- ### Configure differentPropertyType Executable with CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/differentPropertyType/CMakeLists.txt This CMake code defines an executable named 'differentPropertyType' and configures it to use Qt Remote Objects and Qt Test libraries. It also generates a replica definition from a .rep file. ```cmake qt_internal_add_executable(differentPropertyType OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../mismatch.cpp INCLUDE_DIRECTORIES .. LIBRARIES Qt::RemoteObjects Qt::Test ) qt6_add_repc_replicas(differentPropertyType mismatch.rep ) ``` -------------------------------- ### Find Qt6 Components Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Locates and makes the Qt6 Core and RemoteObjects modules available for the project. ```cmake find_package(Qt6 REQUIRED COMPONENTS Core RemoteObjects) ``` -------------------------------- ### Generate Replication Code Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/scrambledProperties/CMakeLists.txt Uses the qt6_add_repc_replicas CMake function to generate C++ code from a .rep definition file. This is essential for enabling remote object communication for the 'scrambledProperties' target. ```cmake qt6_add_repc_replicas(scrambledProperties mismatch.rep ) ``` -------------------------------- ### Add Executable for Scrambled Properties Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/scrambledProperties/CMakeLists.txt Configures the build system to create an executable named 'scrambledProperties'. It specifies the output directory, source files, include directories, and links against Qt Remote Objects and Qt Test libraries. ```cmake qt_internal_add_executable(scrambledProperties OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../mismatch.cpp INCLUDE_DIRECTORIES .. LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Generate Replicas for Scrambled Signals Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/scrambledSignals/CMakeLists.txt Generates C++ replica code from a '.rep' file for the 'scrambledSignals' target. This is used for Qt Remote Objects communication. ```cmake qt6_add_repc_replicas(scrambledSignals mismatch.rep ) ``` -------------------------------- ### Generate C++ Sources from .rep File Source: https://github.com/qt/qtremoteobjects/blob/dev/src/remoteobjects/doc/snippets/cmake-macros/CMakeLists.txt Generates C++ source files from a .rep interface definition file for a specific target. Use this when the .rep file defines the interface for a server or a standalone object. ```cmake qt6_add_repc_sources(directconnectserver simpleswitch.rep ) ``` -------------------------------- ### Set Target Properties for Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Configures properties for the executable, such as making it a Windows executable and disabling macOS bundle creation. ```cmake set_target_properties(sslcppclient PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE FALSE ) ``` -------------------------------- ### Define Executable Target Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Creates the main executable target for the C++ client application. ```cmake qt_add_executable(sslcppclient main.cpp ) ``` -------------------------------- ### Adding Simpleswitch Subdirectory in CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/manual/examples/CMakeLists.txt Adds the 'simpleswitch' subdirectory. This is a straightforward inclusion without specific conditional checks. ```cmake add_subdirectory(simpleswitch) ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt Specifies the minimum required CMake version and names the C++ project. ```cmake cmake_minimum_required(VERSION 3.16) project(sslcppclient LANGUAGES CXX) ``` -------------------------------- ### Configure differentPropertyCountChild Executable Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/differentPropertyCountChild/CMakeLists.txt Defines the CMake build for the 'differentPropertyCountChild' executable. It specifies source files, include directories, and links against necessary Qt modules. This is used for the child side of a Qt Remote Objects connection. ```cmake qt_internal_add_executable(differentPropertyCountChild OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../mismatch.cpp INCLUDE_DIRECTORIES .. LIBRARIES Qt::RemoteObjects Qt::Test ) qt6_add_repc_replicas(differentPropertyCountChild mismatch.rep ) ``` -------------------------------- ### Add Executable for Scrambled Signals Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/auto/repc/signature/scrambledSignals/CMakeLists.txt Defines the 'scrambledSignals' executable, specifying its output directory, source files, include directories, and required libraries. ```cmake qt_internal_add_executable(scrambledSignals OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../mismatch.cpp INCLUDE_DIRECTORIES .. LIBRARIES Qt::RemoteObjects Qt::Test ) ``` -------------------------------- ### Generate .rep Interfaces from Headers Source: https://github.com/qt/qtremoteobjects/blob/dev/src/remoteobjects/doc/snippets/cmake-macros/CMakeLists.txt Generates .rep interface files from C++ header files. This macro is useful for defining remote objects based on existing C++ class definitions. ```cmake qt6_reps_from_headers(directconnectexample simpleswitch.h ) ``` -------------------------------- ### Link Qt Remote Objects Library Source: https://github.com/qt/qtremoteobjects/blob/dev/src/remoteobjects/doc/snippets/cmake-macros/CMakeLists.txt Links the Qt6::RemoteObjects library to your executable target. This is required for any target that uses Qt Remote Objects functionality. ```cmake target_link_libraries(directconnectserver PRIVATE Qt6::RemoteObjects) ``` -------------------------------- ### Include Remote Objects Subdirectory Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/CMakeLists.txt Adds the remoteobjects subdirectory to the build, incorporating its CMakeLists.txt. ```cmake add_subdirectory(remoteobjects) ``` -------------------------------- ### Conditional Subdirectory Inclusion in CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/manual/examples/CMakeLists.txt Includes subdirectories based on target availability and platform conditions. Use this to conditionally add modules like qmlmodelviewclient. ```cmake if(TARGET Qt::Quick AND UNIX AND NOT ANDROID) add_subdirectory(qmlmodelviewclient) endif() ``` -------------------------------- ### Check for Android Build Source: https://github.com/qt/qtremoteobjects/blob/dev/examples/remoteobjects/ssl/sslcppclient/CMakeLists.txt This check prevents the project from being built on Android, as it's not supported. ```cmake if (ANDROID) message(FATAL_ERROR "This project cannot be built on Android.") endif() ``` -------------------------------- ### Conditional Inclusion of BLE Subdirectory in CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/manual/examples/CMakeLists.txt Includes the 'ble' subdirectory only if both Qt::Bluetooth and Qt::Widgets targets are available. This is useful for features requiring both Bluetooth and Widgets. ```cmake if(TARGET Qt::Bluetooth AND TARGET Qt::Widgets) add_subdirectory(ble) endif() ``` -------------------------------- ### Conditional Subdirectory Inclusion in CMake Source: https://github.com/qt/qtremoteobjects/blob/dev/tests/manual/examples/simpleswitch/CMakeLists.txt Includes subdirectories for Qt Remote Objects client and server implementations only when the target platform is not Android. This allows for platform-specific build configurations. ```cmake if (NOT ANDROID) add_subdirectory(directconnectdynamicclient) add_subdirectory(registryconnectedclient) add_subdirectory(registryconnectedserver) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.