summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-19 22:25:47 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-19 22:25:47 +0100
commit5fe029fd127dd70079a01eb6dfbd347954bba9de (patch)
tree0624b94a4fe09aafc6debdac1cd23797200c9992 /CMakeLists.txt
parentaf758b3060e385f7fc204258f95c14379c2d6982 (diff)
downloadBobinkQtOpcUa-5fe029fd127dd70079a01eb6dfbd347954bba9de.tar.gz
BobinkQtOpcUa-5fe029fd127dd70079a01eb6dfbd347954bba9de.zip
Install QtOpcUa to local prefix instead of system Qt directory
Add QTOPCUA_INSTALL_DIR and CMAKE_INSTALL_PREFIX so QtOpcUa installs to build/deps/qtopcua-install/ rather than polluting ~/Qt/6.10.2/. Use QT_ADDITIONAL_PACKAGES_PREFIX_PATH so Qt's find_package resolves OpcUa from the local install.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 5 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2607734..6a9265f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Build external dependencies (open62541, qtopcua) if not already built
include(cmake/BuildDeps.cmake)
-# Local QtOpcUa must come before system Qt so find_package picks up our build
-# instead of any system-installed QtOpcUa.
-list(PREPEND CMAKE_PREFIX_PATH "${QTOPCUA_BUILD_DIR}")
+# Tell Qt's find_package to also look in our local QtOpcUa install for
+# components (Qt6Config.cmake only searches its own install dir by default).
+list(PREPEND QT_ADDITIONAL_PACKAGES_PREFIX_PATH "${QTOPCUA_INSTALL_DIR}")
list(PREPEND CMAKE_PREFIX_PATH "${OPEN62541_INSTALL_DIR}")
find_package(Qt6 6.10.2 REQUIRED COMPONENTS Core Qml Quick OpcUa)
@@ -27,7 +27,8 @@ set(QML_IMPORT_PATH
# Ensure the local QtOpcUa and open62541 libs are findable at runtime (needed
# because the Qt plugin loader dlopen's the open62541 backend).
-set(CMAKE_BUILD_RPATH "${QTOPCUA_BUILD_DIR}/lib" "${OPEN62541_INSTALL_DIR}/lib")
+set(CMAKE_BUILD_RPATH "${QTOPCUA_INSTALL_DIR}/lib"
+ "${OPEN62541_INSTALL_DIR}/lib")
add_subdirectory(src)
add_subdirectory(demo)