From 477da7c1d0ce4c5ef4a45e7599b8d9ffbd03e5e3 Mon Sep 17 00:00:00 2001 From: Iikka Eklund Date: Thu, 4 Feb 2021 08:13:09 +0200 Subject: Conan: Use the 'shared' option value of the Qt build Default to the value of the prebuilt Qt build. The 'default' needs to be added as valid option in the list which will be used by default if no value is given by the user or via the conan profile. The user is still able to override this via the profile or from command line if needed: "conan install ... -o shared=False" CMakeCache.txt: - "conan install ..." - BUILD_SHARED_LIBS:BOOL=ON - "conan install ... -o shared=True" - BUILD_SHARED_LIBS:BOOL=ON - "conan install ... -o shared=False" - BUILD_SHARED_LIBS:BOOL=OFF Task-number: QTBUG-90901 Change-Id: Ifd9ef0d982a1f1e4a3f454e3d5e4c7075f873c22 Reviewed-by: Joerg Bornemann (cherry picked from commit b2d0ef3f7ab36b93a51eb0bea14afe1e9fc5c0d1) Reviewed-by: Qt Cherry-pick Bot --- conanfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index dd86a61ac..9b4d2d8fc 100644 --- a/conanfile.py +++ b/conanfile.py @@ -43,9 +43,9 @@ class Qt3D(ConanFile): description = "Qt 3D provides functionality for near-realtime simulation systems with support for 2D and 3D rendering in both Qt C++ and Qt Quick applications." topics = ("qt", "qt6", "3d", "qtquick") settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], + options = {"shared": [True, False, "default"], "qt6": "ANY"} # this is needed to model unique package_id for the Add-on build per used Qt6 version - default_options = {"shared": False, + default_options = {"shared": "default", # default: Use the value of the Qt build "qt6": None} exports_sources = "*", "!conan*.*" @@ -87,6 +87,10 @@ class Qt3D(ConanFile): install_dir = os.path.join(os.getcwd(), "_install_tmp") cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_dir + # Use the value of the Qt build + if self.options.shared.value == "default": + del cmake.definitions["BUILD_SHARED_LIBS"] + cmake_toolchain_file = os.environ.get("CMAKE_TOOLCHAIN_FILE") if cmake_toolchain_file: cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = cmake_toolchain_file -- cgit v1.2.3