From d9dc619ee4ed07c520eea8614ecdc557cbd93663 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 10 Feb 2023 13:05:58 +0100 Subject: [PATCH] remove option.fPIC for shared in conan new templates (#13066) * remove option.fPIC for shared * fix test --- conan/internal/api/new/autotools_lib.py | 6 +++++- conan/internal/api/new/bazel_lib.py | 6 +++++- conan/internal/api/new/cmake_lib.py | 6 +++++- conan/internal/api/new/meson_lib.py | 6 +++++- conans/test/assets/pkg_cmake.py | 6 +++++- .../toolchains/gnu/autotools/test_apple_toolchain.py | 6 +++++- .../test/functional/toolchains/gnu/autotools/test_basic.py | 2 +- conans/test/functional/toolchains/meson/test_backend.py | 6 +++++- .../functional/toolchains/meson/test_cross_compilation.py | 6 +++++- conans/test/functional/toolchains/meson/test_install.py | 6 +++++- conans/test/functional/toolchains/meson/test_meson.py | 6 +++++- .../test/functional/toolchains/meson/test_meson_and_objc.py | 6 +++++- 12 files changed, 56 insertions(+), 12 deletions(-) diff --git a/conan/internal/api/new/autotools_lib.py b/conan/internal/api/new/autotools_lib.py index fe653fb8a98..b511f0bf885 100644 --- a/conan/internal/api/new/autotools_lib.py +++ b/conan/internal/api/new/autotools_lib.py @@ -30,7 +30,11 @@ class {{package_name}}Conan(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): basic_layout(self) diff --git a/conan/internal/api/new/bazel_lib.py b/conan/internal/api/new/bazel_lib.py index df380346295..9775a913795 100644 --- a/conan/internal/api/new/bazel_lib.py +++ b/conan/internal/api/new/bazel_lib.py @@ -21,7 +21,11 @@ class {{package_name}}Recipe(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): bazel_layout(self) diff --git a/conan/internal/api/new/cmake_lib.py b/conan/internal/api/new/cmake_lib.py index d2e87ca2a9e..25c3d731d28 100644 --- a/conan/internal/api/new/cmake_lib.py +++ b/conan/internal/api/new/cmake_lib.py @@ -23,7 +23,11 @@ class {{package_name}}Recipe(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self) diff --git a/conan/internal/api/new/meson_lib.py b/conan/internal/api/new/meson_lib.py index fcc1926d887..b23a3f19f9d 100644 --- a/conan/internal/api/new/meson_lib.py +++ b/conan/internal/api/new/meson_lib.py @@ -20,7 +20,11 @@ class {{package_name}}Conan(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): basic_layout(self) diff --git a/conans/test/assets/pkg_cmake.py b/conans/test/assets/pkg_cmake.py index 8dd89265d99..373dac53c89 100644 --- a/conans/test/assets/pkg_cmake.py +++ b/conans/test/assets/pkg_cmake.py @@ -28,7 +28,11 @@ class Pkg(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self) diff --git a/conans/test/functional/toolchains/gnu/autotools/test_apple_toolchain.py b/conans/test/functional/toolchains/gnu/autotools/test_apple_toolchain.py index 3b01f6de910..e1c419494a6 100644 --- a/conans/test/functional/toolchains/gnu/autotools/test_apple_toolchain.py +++ b/conans/test/functional/toolchains/gnu/autotools/test_apple_toolchain.py @@ -23,7 +23,11 @@ class App(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def build(self): env_build = Autotools(self) diff --git a/conans/test/functional/toolchains/gnu/autotools/test_basic.py b/conans/test/functional/toolchains/gnu/autotools/test_basic.py index 666c68c4617..9226cfa5b40 100644 --- a/conans/test/functional/toolchains/gnu/autotools/test_basic.py +++ b/conans/test/functional/toolchains/gnu/autotools/test_basic.py @@ -325,7 +325,7 @@ class MyLibConan(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): basic_layout(self) diff --git a/conans/test/functional/toolchains/meson/test_backend.py b/conans/test/functional/toolchains/meson/test_backend.py index 60d2fe0e439..a3da4b6e914 100644 --- a/conans/test/functional/toolchains/meson/test_backend.py +++ b/conans/test/functional/toolchains/meson/test_backend.py @@ -25,7 +25,11 @@ class App(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): self.folders.build = "build" diff --git a/conans/test/functional/toolchains/meson/test_cross_compilation.py b/conans/test/functional/toolchains/meson/test_cross_compilation.py index ec762751eb2..14d52bc6a5d 100644 --- a/conans/test/functional/toolchains/meson/test_cross_compilation.py +++ b/conans/test/functional/toolchains/meson/test_cross_compilation.py @@ -24,7 +24,11 @@ def layout(self): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def generate(self): tc = MesonToolchain(self) diff --git a/conans/test/functional/toolchains/meson/test_install.py b/conans/test/functional/toolchains/meson/test_install.py index 2345144f6fb..be92a7bacae 100644 --- a/conans/test/functional/toolchains/meson/test_install.py +++ b/conans/test/functional/toolchains/meson/test_install.py @@ -23,7 +23,11 @@ class App(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): self.folders.build = "build" diff --git a/conans/test/functional/toolchains/meson/test_meson.py b/conans/test/functional/toolchains/meson/test_meson.py index 59e1c1a9692..861b97870f4 100644 --- a/conans/test/functional/toolchains/meson/test_meson.py +++ b/conans/test/functional/toolchains/meson/test_meson.py @@ -25,7 +25,11 @@ class App(ConanFile): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def layout(self): self.folders.generators = 'build/gen_folder' diff --git a/conans/test/functional/toolchains/meson/test_meson_and_objc.py b/conans/test/functional/toolchains/meson/test_meson_and_objc.py index aaf3f6e1dd2..1141bc25bff 100644 --- a/conans/test/functional/toolchains/meson/test_meson_and_objc.py +++ b/conans/test/functional/toolchains/meson/test_meson_and_objc.py @@ -23,7 +23,11 @@ def layout(self): def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") def generate(self): tc = MesonToolchain(self)