From 8014395eb146a5869d1ff290651576e517e57484 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 24 Oct 2022 23:17:25 -0400 Subject: [PATCH 01/39] CMake Conan 2.0 compatibility --- recipes/cmake/3.x.x/conanfile.py | 116 +++++++++--------- recipes/cmake/3.x.x/test_package/conanfile.py | 4 +- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 6fa70380c571e..81566c58ee17e 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,20 +1,23 @@ -import os -from conan import ConanFile +from conan import ConanFile, conan_version +from conan.tools.files import chdir, copy, rmdir, replace_in_file +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version -from conan.tools.files import rmdir, get -from conans import tools, AutoToolsBuildEnvironment, CMake -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.errors import ConanException +import os -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.52.0" class CMakeConan(ConanFile): name = "cmake" + package_type = "application" description = "Conan installer for CMake" topics = ("cmake", "build", "installer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Kitware/CMake" license = "BSD-3-Clause" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -26,9 +29,6 @@ class CMakeConan(ConanFile): "bootstrap": False, } - _source_subfolder = "source_subfolder" - _cmake = None - def config_options(self): if self.settings.os == "Windows": self.options.with_openssl = False @@ -38,15 +38,15 @@ def requirements(self): self.requires("openssl/1.1.1q") def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": + if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.settings.os == "Windows" and self.options.bootstrap: + if self.info.settings.os == "Windows" and self.info.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "4.8", @@ -55,66 +55,69 @@ def validate(self): "Visual Studio": "14", } - compiler = str(self.settings.compiler) + compiler = str(self.info.settings.compiler) if compiler not in minimal_version: - self.output.warn( + self.output.warning( "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) - self.output.warn( + self.output.warning( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) return - version = Version(self.settings.compiler.version) + version = Version(self.info.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self.info.options.bootstrap: + tc = AutotoolsToolchain(self) + tc.generate() + else: + tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - self._cmake.definitions["CMAKE_BOOTSTRAP"] = False + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["CMAKE_BOOTSTRAP"] = False if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_openssl + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_openssl if self.options.with_openssl: - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - if tools.cross_building(self): - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE"] = '' - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' - self._cmake.configure(source_folder=self._source_subfolder) - - return self._cmake + openssl = self.dependencies["openssl"] + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not openssl.options.shared + if cross_building(self): + tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' + tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' + tc.generate() def build(self): - if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - self.run(['./bootstrap', '--prefix={}'.format(self.package_folder), '--parallel={}'.format(tools.cpu_count())]) - autotools = AutoToolsBuildEnvironment(self) + if self.info.options.bootstrap: + with chdir(self, self.source_folder): + self.run('./bootstrap --prefix="" --parallel={}'.format(build_jobs(self))) + autotools = Autotools(self) autotools.make() else: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "project(CMake)", - "project(CMake)\ninclude(\"{}/conanbuildinfo.cmake\")\nconan_basic_setup(NO_OUTPUT_DIRS)".format( - self.install_folder.replace("\\", "/"))) if self.settings.os == "Linux": - tools.replace_in_file(os.path.join(self._source_subfolder, "Utilities", "cmcurl", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "Utilities", "cmcurl", "CMakeLists.txt"), "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} pthread)") - - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) + copy(self, "Copyright.txt", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() else: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.install() rmdir(self, os.path.join(self.package_folder, "doc")) @@ -122,18 +125,19 @@ def package_id(self): del self.info.settings.compiler def package_info(self): - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) - - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) - self.env_info.CMAKE_ROOT = self.package_folder + self.runenv_info.define_path("CMAKE_ROOT", self.package_folder) + module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) mod_path = os.path.join(self.package_folder, "share", f"cmake-{module_version}", "Modules") self.buildenv_info.prepend_path("CMAKE_MODULE_PATH", mod_path) - self.env_info.CMAKE_MODULE_PATH = mod_path + self.runenv_info.define_path("CMAKE_MODULE_PATH", mod_path) if not os.path.exists(mod_path): raise ConanException("Module path not found: %s" % mod_path) self.cpp_info.includedirs = [] + + # TODO remove once conan v2 is the only support and recipes have been migrated + if Version(conan_version).major < 2: + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.runenv_info.append_path("PATH", bindir) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 0b0c4858e1c60..5ffe766c266c7 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -14,10 +14,10 @@ def requirements(self): def test(self): if can_run(self): output = StringIO() - self.run("cmake --version", env="conanrun", output=output) + self.run("cmake --version", env="conanrun", stdout=output) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["cmake"].version) + require_version = str(self.dependencies["cmake"].ref.version) self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From 3279e24a799f387fbe6484726b0026c65d3237d2 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 24 Oct 2022 23:44:33 -0400 Subject: [PATCH 02/39] Fix lint errors --- recipes/cmake/3.x.x/conanfile.py | 8 ++++---- recipes/cmake/3.x.x/test_package/conanfile.py | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 81566c58ee17e..333de79660412 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile, conan_version -from conan.tools.files import chdir, copy, rmdir, replace_in_file +from conan.tools.files import chdir, copy, rmdir, get, replace_in_file from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout from conan.tools.gnu import AutotoolsToolchain, Autotools from conan.tools.build import build_jobs, cross_building, check_min_cppstd @@ -70,11 +70,11 @@ def validate(self): def layout(self): cmake_layout(self, src_folder="src") - + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - + def generate(self): if self.info.options.bootstrap: tc = AutotoolsToolchain(self) @@ -135,7 +135,7 @@ def package_info(self): raise ConanException("Module path not found: %s" % mod_path) self.cpp_info.includedirs = [] - + # TODO remove once conan v2 is the only support and recipes have been migrated if Version(conan_version).major < 2: bindir = os.path.join(self.package_folder, "bin") diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 5ffe766c266c7..2be2eb6f7865d 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,7 +1,8 @@ import os from six import StringIO -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.build import can_run +from conan.tools.scm import Version class TestPackageConan(ConanFile): @@ -14,7 +15,10 @@ def requirements(self): def test(self): if can_run(self): output = StringIO() - self.run("cmake --version", env="conanrun", stdout=output) + if Version(conan_version).major < 2: + self.run("cmake --version", env="conanrun", output=output) + else: + self.run("cmake --version", env="conanrun", stdout=output) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) require_version = str(self.dependencies["cmake"].ref.version) From 312df475b8d65dd8cb9f829809bbf86108ced901 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 24 Oct 2022 23:55:51 -0400 Subject: [PATCH 03/39] Avoid lint error with Conan 2.0 argument name --- recipes/cmake/3.x.x/test_package/conanfile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 2be2eb6f7865d..072c23e7d53df 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -15,10 +15,8 @@ def requirements(self): def test(self): if can_run(self): output = StringIO() - if Version(conan_version).major < 2: - self.run("cmake --version", env="conanrun", output=output) - else: - self.run("cmake --version", env="conanrun", stdout=output) + # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it + self.run("cmake --version", env="conanrun", output) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) require_version = str(self.dependencies["cmake"].ref.version) From 3498d3fe14842e0a14ee972589bdfaec0e691622 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 00:01:36 -0400 Subject: [PATCH 04/39] Avoid lint error with Conan 2.0 argument name --- recipes/cmake/3.x.x/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 072c23e7d53df..71a905bc452b1 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -16,7 +16,7 @@ def test(self): if can_run(self): output = StringIO() # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it - self.run("cmake --version", env="conanrun", output) + self.run("cmake --version", output, env="conanrun") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) require_version = str(self.dependencies["cmake"].ref.version) From bb9383d2167ce96cacbb6f1d82be6f0bcfa69199 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 00:35:04 -0400 Subject: [PATCH 05/39] Removed unused imports --- recipes/cmake/3.x.x/test_package/conanfile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 71a905bc452b1..20371df73051d 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,8 +1,6 @@ -import os from six import StringIO -from conan import ConanFile, conan_version +from conan import ConanFile from conan.tools.build import can_run -from conan.tools.scm import Version class TestPackageConan(ConanFile): From 31ab1a3e5f604aab5aea5be471b860a9167aeac1 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 07:08:38 -0400 Subject: [PATCH 06/39] Handle Conan version disparities --- recipes/cmake/3.x.x/test_package/conanfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 20371df73051d..a27630d65fbda 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,6 +1,7 @@ from six import StringIO -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.build import can_run +from conan.tools.scm import Version class TestPackageConan(ConanFile): @@ -17,7 +18,10 @@ def test(self): self.run("cmake --version", output, env="conanrun") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.dependencies["cmake"].ref.version) + if Version(conan_version).major < 2: + require_version = str(self.deps_cpp_info["cmake"].version) + else: + require_version = str(self.dependencies["cmake"].ref.version) self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From 05f13da87ad877e5855d4649adc42b28df85f71b Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 17:41:11 -0400 Subject: [PATCH 07/39] Use basic_layout with Autotools Co-authored-by: Uilian Ries --- recipes/cmake/3.x.x/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 333de79660412..68904b9203b93 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -69,7 +69,10 @@ def validate(self): "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) def layout(self): - cmake_layout(self, src_folder="src") + if self.options.bootstrap: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], From 5769d2c83d94882c80ac47f6f3764b7ba712eb08 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 17:43:55 -0400 Subject: [PATCH 08/39] Call AutotoolsDeps generate Co-authored-by: Uilian Ries --- recipes/cmake/3.x.x/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 68904b9203b93..1a9d1a78e84f9 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -82,6 +82,8 @@ def generate(self): if self.info.options.bootstrap: tc = AutotoolsToolchain(self) tc.generate() + tc = AutotoolsDeps(self) + tc.generate() else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: From b00e0bd09870a0e776f3cf2e1c153c205f7e9e2e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:15:17 -0400 Subject: [PATCH 09/39] Call CMakeDeps generate Co-authored-by: Uilian Ries --- recipes/cmake/3.x.x/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 1a9d1a78e84f9..803e25444f5e5 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -98,6 +98,8 @@ def generate(self): tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): if self.info.options.bootstrap: From 520b6e1a0704a4f5406615be7fe66fdbe22b2c5e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:24:29 -0400 Subject: [PATCH 10/39] Update imports per suggestioned changes --- recipes/cmake/3.x.x/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 803e25444f5e5..40cb8fe618393 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile, conan_version from conan.tools.files import chdir, copy, rmdir, get, replace_in_file -from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout -from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration From 4be090063def2f14ecdbb0c5b5a87ecd8144aee1 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:33:36 -0400 Subject: [PATCH 11/39] Removed extra space --- recipes/cmake/3.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 40cb8fe618393..71902ef49bb04 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile, conan_version from conan.tools.files import chdir, copy, rmdir, get, replace_in_file from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version From 8a867426b1d136229d561809b0c9b25d62abc6ec Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 26 Oct 2022 11:49:55 -0400 Subject: [PATCH 12/39] Remove extraneous items --- recipes/cmake/3.x.x/conanfile.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 71902ef49bb04..40278cfc80a12 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile, conan_version from conan.tools.files import chdir, copy, rmdir, get, replace_in_file -from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version @@ -83,8 +83,6 @@ def generate(self): if self.info.options.bootstrap: tc = AutotoolsToolchain(self) tc.generate() - tc = AutotoolsDeps(self) - tc.generate() else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: @@ -99,8 +97,6 @@ def generate(self): tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' tc.generate() - tc = CMakeDeps(self) - tc.generate() def build(self): if self.info.options.bootstrap: @@ -109,10 +105,6 @@ def build(self): autotools = Autotools(self) autotools.make() else: - if self.settings.os == "Linux": - replace_in_file(self, os.path.join(self.source_folder, "Utilities", "cmcurl", "CMakeLists.txt"), - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} pthread)") cmake = CMake(self) cmake.configure() cmake.build() From cb56f4713c851eeace02ec0c2e3674e2e786c37e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 2 Nov 2022 19:15:21 -0400 Subject: [PATCH 13/39] Determine require_version in a version-agnostic manner --- recipes/cmake/3.x.x/test_package/conanfile.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index a27630d65fbda..945051656e2f0 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,7 +1,6 @@ from six import StringIO -from conan import ConanFile, conan_version +from conan import ConanFile from conan.tools.build import can_run -from conan.tools.scm import Version class TestPackageConan(ConanFile): @@ -18,10 +17,7 @@ def test(self): self.run("cmake --version", output, env="conanrun") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - if Version(conan_version).major < 2: - require_version = str(self.deps_cpp_info["cmake"].version) - else: - require_version = str(self.dependencies["cmake"].ref.version) + name, require_version = self.tested_reference_str.split("/", 1) self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From fe4cb86d9a10de1a978151332d28691e8525b9f6 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 2 Nov 2022 19:19:39 -0400 Subject: [PATCH 14/39] Use Conan 1.53 --- recipes/cmake/3.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 40278cfc80a12..613a9d10cecb1 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,7 +9,7 @@ from conan.errors import ConanException import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): name = "cmake" From 8154df48bcb9c6c8bdb6ffce0e125b357f23cbca Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 2 Nov 2022 20:04:56 -0400 Subject: [PATCH 15/39] Handle @ in ref --- recipes/cmake/3.x.x/conanfile.py | 16 ++++++++-------- recipes/cmake/3.x.x/test_package/conanfile.py | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 613a9d10cecb1..be432f23da00a 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile, conan_version +from conan import ConanFile from conan.tools.files import chdir, copy, rmdir, get, replace_in_file from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -42,7 +42,7 @@ def validate(self): if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.info.settings.os == "Windows" and self.info.options.bootstrap: + if self.info.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" @@ -80,7 +80,7 @@ def source(self): destination=self.source_folder, strip_root=True) def generate(self): - if self.info.options.bootstrap: + if self.options.bootstrap: tc = AutotoolsToolchain(self) tc.generate() else: @@ -99,7 +99,7 @@ def generate(self): tc.generate() def build(self): - if self.info.options.bootstrap: + if self.options.bootstrap: with chdir(self, self.source_folder): self.run('./bootstrap --prefix="" --parallel={}'.format(build_jobs(self))) autotools = Autotools(self) @@ -123,6 +123,7 @@ def package(self): def package_id(self): del self.info.settings.compiler + del self.info.options.bootstrap def package_info(self): self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) @@ -137,7 +138,6 @@ def package_info(self): self.cpp_info.includedirs = [] # TODO remove once conan v2 is the only support and recipes have been migrated - if Version(conan_version).major < 2: - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.runenv_info.append_path("PATH", bindir) + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.runenv_info.append_path("PATH", bindir) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 945051656e2f0..1b872039f3439 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -17,7 +17,8 @@ def test(self): self.run("cmake --version", output, env="conanrun") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - name, require_version = self.tested_reference_str.split("/", 1) + tokens = self.tested_reference_str.split("@", 1) + name, require_version = tokens[0].split("/", 1) self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From 887635c6a8e5c4260e2b33cba61aa2712c63db59 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 2 Nov 2022 20:31:12 -0400 Subject: [PATCH 16/39] Fix lint errors --- recipes/cmake/3.x.x/conanfile.py | 2 +- recipes/cmake/3.x.x/test_package/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index be432f23da00a..e7454867fe20c 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import chdir, copy, rmdir, get, replace_in_file +from conan.tools.files import chdir, copy, rmdir, get from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 1b872039f3439..51997846e55cc 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -18,7 +18,7 @@ def test(self): output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) tokens = self.tested_reference_str.split("@", 1) - name, require_version = tokens[0].split("/", 1) + require_version = tokens[0].split("/", 1)[1] self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From a4b5d3a96aac33d79eadf12b6b51a3b95cfd690c Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 2 Nov 2022 22:10:31 -0400 Subject: [PATCH 17/39] Bigger hammer --- recipes/cmake/3.x.x/test_package/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 51997846e55cc..2ea5783b8f589 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,6 +1,7 @@ from six import StringIO from conan import ConanFile from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): @@ -17,7 +18,7 @@ def test(self): self.run("cmake --version", output, env="conanrun") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - tokens = self.tested_reference_str.split("@", 1) + tokens = re.split('[@#]', self.tested_reference_str) require_version = tokens[0].split("/", 1)[1] self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version From cede0fe56fac8bf52ba439529e4649dfe641c31a Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 3 Nov 2022 14:54:02 -0400 Subject: [PATCH 18/39] Remove PATH addition in package_id Co-authored-by: Chris Mc --- recipes/cmake/3.x.x/conanfile.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index e7454867fe20c..4b3158bf19b9f 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -136,8 +136,3 @@ def package_info(self): raise ConanException("Module path not found: %s" % mod_path) self.cpp_info.includedirs = [] - - # TODO remove once conan v2 is the only support and recipes have been migrated - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.runenv_info.append_path("PATH", bindir) From b6accd32531e8412e91a7337ee6fcd5b0f854a7d Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 3 Nov 2022 15:59:55 -0400 Subject: [PATCH 19/39] Use validate_build instead of validate --- recipes/cmake/3.x.x/conanfile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 4b3158bf19b9f..abb3cbf273224 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -38,15 +38,15 @@ def requirements(self): if self.options.with_openssl: self.requires("openssl/1.1.1q") - def validate(self): - if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": + def validate_build(self): + if self.settings.os == "Macos" and self.settings.arch == "x86": raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.info.settings.os == "Windows" and self.options.bootstrap: + if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" - if self.info.settings.get_safe("compiler.cppstd"): + if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, minimal_cpp_standard) minimal_version = { @@ -56,7 +56,7 @@ def validate(self): "Visual Studio": "14", } - compiler = str(self.info.settings.compiler) + compiler = str(self.settings.compiler) if compiler not in minimal_version: self.output.warning( "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) @@ -64,7 +64,7 @@ def validate(self): "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) return - version = Version(self.info.settings.compiler.version) + version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) From 8c33609d58d00e0c3ee33bfdf7f0183273508786 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 14 Nov 2022 11:16:54 -0500 Subject: [PATCH 20/39] Moved Mac x86 check to validate() method. --- recipes/cmake/3.x.x/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index abb3cbf273224..b26963798aa14 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -39,9 +39,6 @@ def requirements(self): self.requires("openssl/1.1.1q") def validate_build(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") @@ -69,6 +66,10 @@ def validate_build(self): raise ConanInvalidConfiguration( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + def validate(self): + if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": + raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + def layout(self): if self.options.bootstrap: basic_layout(self, src_folder="src") From f0fea9eda23a3de6cbcce5d301fa2b34cd9fe9e8 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 14 Nov 2022 14:59:59 -0500 Subject: [PATCH 21/39] Bump openssl version Co-authored-by: Chris Mc --- recipes/cmake/3.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index b26963798aa14..b442f056c119d 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -36,7 +36,7 @@ def config_options(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate_build(self): if self.settings.os == "Windows" and self.options.bootstrap: From ed5ef3041b258b2009c49f5dfd875c0679ecce82 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 15 Nov 2022 18:24:50 -0500 Subject: [PATCH 22/39] Add blank line to trigger CI build --- recipes/cmake/3.x.x/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 6e0690395abac..07968b648dd26 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,6 +9,7 @@ from conan.errors import ConanException import os + required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): From 0485ca365418cddd5d81fa483aeeba3727f697db Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:53:40 -0500 Subject: [PATCH 23/39] Eliminate use of validate_build() --- recipes/cmake/3.x.x/conanfile.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 07968b648dd26..9ed2cd9db1323 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,7 +9,6 @@ from conan.errors import ConanException import os - required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): @@ -43,12 +42,11 @@ def validate(self): if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - def validate_build(self): - if self.settings.os == "Windows" and self.options.bootstrap: + if self.info.settings.os == "Windows" and self.info.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" - if self.settings.get_safe("compiler.cppstd"): + if self.info.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, minimal_cpp_standard) minimal_version = { @@ -58,7 +56,7 @@ def validate_build(self): "Visual Studio": "14", } - compiler = str(self.settings.compiler) + compiler = str(self.info.settings.compiler) if compiler not in minimal_version: self.output.warning( "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) @@ -66,7 +64,7 @@ def validate_build(self): "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) return - version = Version(self.settings.compiler.version) + version = Version(self.info.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) From 4713991a3bdd96de56fc532aa294d7bf623c929a Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Fri, 18 Nov 2022 08:38:50 -0500 Subject: [PATCH 24/39] Restore use of validate_build() --- recipes/cmake/3.x.x/conanfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 9ed2cd9db1323..07968b648dd26 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,6 +9,7 @@ from conan.errors import ConanException import os + required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): @@ -42,11 +43,12 @@ def validate(self): if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.info.settings.os == "Windows" and self.info.options.bootstrap: + def validate_build(self): + if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" - if self.info.settings.get_safe("compiler.cppstd"): + if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, minimal_cpp_standard) minimal_version = { @@ -56,7 +58,7 @@ def validate(self): "Visual Studio": "14", } - compiler = str(self.info.settings.compiler) + compiler = str(self.settings.compiler) if compiler not in minimal_version: self.output.warning( "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) @@ -64,7 +66,7 @@ def validate(self): "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) return - version = Version(self.info.settings.compiler.version) + version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) From e582a53228a86c9396400b5da8bd81e126b4e035 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 29 Nov 2022 08:45:57 -0500 Subject: [PATCH 25/39] Removed blank line to trigger CI --- recipes/cmake/3.x.x/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 71a5d0b3a2e82..c3745fbaf28fa 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,7 +9,6 @@ from conan.errors import ConanException import os - required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): From be5ffcfa9b15b334aae9c258332afe1edf811f2e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 1 Dec 2022 17:28:03 -0500 Subject: [PATCH 26/39] Add blank line to trigger CI --- recipes/cmake/3.x.x/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index c3745fbaf28fa..71a5d0b3a2e82 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,6 +9,7 @@ from conan.errors import ConanException import os + required_conan_version = ">=1.53.0" class CMakeConan(ConanFile): From 568f04c434f049cf44a03d787ea71af457ffa697 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Sat, 3 Dec 2022 11:20:57 -0500 Subject: [PATCH 27/39] Added boostrap options and removed unneeded env. vars --- recipes/cmake/3.x.x/conanfile.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 71a5d0b3a2e82..0b1fbf24020f4 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,9 +1,10 @@ from conan import ConanFile from conan.tools.files import chdir, copy, rmdir, get +from conan.tools.files.files import save_toolchain_args, load_toolchain_args from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.build import build_jobs, cross_building, check_min_cppstd +from conan.tools.build import build_jobs, cross_building, check_min_cppstd, cmd_args_to_string from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration from conan.errors import ConanException @@ -55,7 +56,7 @@ def validate_build(self): "gcc": "4.8", "clang": "3.3", "apple-clang": "9", - "Visual Studio": "14", + "msvc": "191", } compiler = str(self.settings.compiler) @@ -86,6 +87,16 @@ def generate(self): if self.options.bootstrap: tc = AutotoolsToolchain(self) tc.generate() + bootstrap_cmake_options = ["--"] + bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') + if self.settings.os == "Linux": + if self.options.with_openssl: + openssl = self.dependencies["openssl"] + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=ON") + bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') + else: + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") + save_toolchain_args({"bootstrap_cmake_options": cmd_args_to_string(bootstrap_cmake_options)}, namespace="bootstrap") else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: @@ -103,8 +114,10 @@ def generate(self): def build(self): if self.options.bootstrap: + toolchain_file_content = load_toolchain_args(self.generators_folder, namespace="bootstrap") + bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") with chdir(self, self.source_folder): - self.run('./bootstrap --prefix="" --parallel={}'.format(build_jobs(self))) + self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') autotools = Autotools(self) autotools.make() else: @@ -120,7 +133,6 @@ def package(self): autotools.install() else: cmake = CMake(self) - cmake.configure() cmake.install() rmdir(self, os.path.join(self.package_folder, "doc")) @@ -129,13 +141,4 @@ def package_id(self): del self.info.options.bootstrap def package_info(self): - self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) - self.runenv_info.define_path("CMAKE_ROOT", self.package_folder) - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) - mod_path = os.path.join(self.package_folder, "share", f"cmake-{module_version}", "Modules") - self.buildenv_info.prepend_path("CMAKE_MODULE_PATH", mod_path) - self.runenv_info.define_path("CMAKE_MODULE_PATH", mod_path) - if not os.path.exists(mod_path): - raise ConanException("Module path not found: %s" % mod_path) - self.cpp_info.includedirs = [] From 5836bfc43de66146f386f5f2868467a7030121ec Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Sat, 3 Dec 2022 11:47:37 -0500 Subject: [PATCH 28/39] Deal with Conan 1.x vs 2.0 inconsistencies --- recipes/cmake/3.x.x/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 0b1fbf24020f4..5999c8903b377 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.build import build_jobs, cross_building, check_min_cppstd, cmd_args_to_string +from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration from conan.errors import ConanException @@ -96,7 +96,7 @@ def generate(self): bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') else: bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") - save_toolchain_args({"bootstrap_cmake_options": cmd_args_to_string(bootstrap_cmake_options)}, namespace="bootstrap") + save_toolchain_args({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)}, namespace="bootstrap") else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: From 19f2c054e726f2df8c72e77abb6dc4a8cedfaa9e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Sat, 3 Dec 2022 11:56:12 -0500 Subject: [PATCH 29/39] Fixed lint issue --- recipes/cmake/3.x.x/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 5999c8903b377..b1d2a9b41bb03 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -7,7 +7,6 @@ from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -from conan.errors import ConanException import os From dd2bdeed7ee9252591d2eaa3ef3951a9822a3bbe Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Sat, 3 Dec 2022 12:06:38 -0500 Subject: [PATCH 30/39] Placate linter --- recipes/cmake/3.x.x/conanfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index b1d2a9b41bb03..7c17bcac6c035 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,6 +1,5 @@ from conan import ConanFile -from conan.tools.files import chdir, copy, rmdir, get -from conan.tools.files.files import save_toolchain_args, load_toolchain_args +from conan.tools.files import chdir, copy, rmdir, get, files from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout @@ -95,7 +94,7 @@ def generate(self): bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') else: bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") - save_toolchain_args({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)}, namespace="bootstrap") + files.save_toolchain_args({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)}, namespace="bootstrap") else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: @@ -113,7 +112,7 @@ def generate(self): def build(self): if self.options.bootstrap: - toolchain_file_content = load_toolchain_args(self.generators_folder, namespace="bootstrap") + toolchain_file_content = files.load_toolchain_args(self.generators_folder, namespace="bootstrap") bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") with chdir(self, self.source_folder): self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') From 58ff30aaa7d45dc0dc5846bc98087eaca36e8812 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 6 Dec 2022 09:18:09 -0500 Subject: [PATCH 31/39] Apply suggestions from code review Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/cmake/3.x.x/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 7c17bcac6c035..63eb26342205b 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -54,6 +54,7 @@ def validate_build(self): "gcc": "4.8", "clang": "3.3", "apple-clang": "9", + "Visual Studio": "14", "msvc": "191", } @@ -140,3 +141,4 @@ def package_id(self): def package_info(self): self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] From c9345afc2ffda056d2a0c26659186b1efef58d06 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:30:06 -0500 Subject: [PATCH 32/39] Use save & load for bootstrap args; Use tool_requires in test packages --- recipes/cmake/3.x.x/conanfile.py | 8 ++++---- recipes/cmake/3.x.x/test_package/conanfile.py | 6 +++--- recipes/cmake/3.x.x/test_v1_package/conanfile.py | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 63eb26342205b..f866e7e5bc97f 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import chdir, copy, rmdir, get, files +from conan.tools.files import chdir, copy, rmdir, get, save, load from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout @@ -7,7 +7,7 @@ from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os - +import json required_conan_version = ">=1.53.0" @@ -95,7 +95,7 @@ def generate(self): bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') else: bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") - files.save_toolchain_args({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)}, namespace="bootstrap") + save(self,"bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: @@ -113,7 +113,7 @@ def generate(self): def build(self): if self.options.bootstrap: - toolchain_file_content = files.load_toolchain_args(self.generators_folder, namespace="bootstrap") + toolchain_file_content = json.loads(load(self, os.path.join(self.generators_folder, "bootstrap_args"))) bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") with chdir(self, self.source_folder): self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 2ea5783b8f589..a3ee351c34357 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -8,14 +8,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch" generators = "VirtualRunEnv" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): if can_run(self): output = StringIO() # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it - self.run("cmake --version", output, env="conanrun") + self.run("cmake --version", output, env="conanbuild") output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) tokens = re.split('[@#]', self.tested_reference_str) diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py index efb629f7d5725..7783501b5203a 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -2,22 +2,24 @@ from six import StringIO from conan import ConanFile from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): settings = "os", "arch" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): if can_run(self): output = StringIO() - self.run("cmake --version", output=output, run_environment=True) + self.run("cmake --version", output=output, run_environment=False) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["cmake"].version) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] self.output.info("Expected version: {}".format(require_version)) assert_cmake_version = "cmake version %s" % require_version assert(assert_cmake_version in output_str) From bb59eb493fa6e3f60e5ba88192aa710a00b27ceb Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:54:27 -0500 Subject: [PATCH 33/39] Eliminate use of validate_build; Add more settings to test recipes --- recipes/cmake/3.x.x/conanfile.py | 8 ++++---- recipes/cmake/3.x.x/test_package/conanfile.py | 2 +- recipes/cmake/3.x.x/test_v1_package/conanfile.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index f866e7e5bc97f..357d63c5d96ef 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -39,13 +39,12 @@ def requirements(self): self.requires("openssl/1.1.1s") def validate(self): - if self.info.settings.os == "Macos" and self.info.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - - def validate_build(self): if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") + if self.settings.os == "Macos" and self.settings.arch == "x86": + raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + minimal_cpp_standard = "11" if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, minimal_cpp_standard) @@ -142,3 +141,4 @@ def package_id(self): def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] + diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index a3ee351c34357..58e759b923aa8 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -5,7 +5,7 @@ class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" generators = "VirtualRunEnv" def build_requirements(self): diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py index 7783501b5203a..4591d33b052b8 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -6,7 +6,7 @@ class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" def build_requirements(self): From 6b5e6e22de6af0b840a68dc39597b4f57883cd2e Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:50:16 -0500 Subject: [PATCH 34/39] Set PATH in package_info() for v1.x; Lower req. ver. to 1.50 --- recipes/cmake/3.x.x/conanfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 357d63c5d96ef..971266ea6d846 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -9,7 +9,7 @@ import os import json -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.50.0" class CMakeConan(ConanFile): name = "cmake" @@ -142,3 +142,8 @@ def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] + # Needed for compatibility with v1.x - Remmove when 2.0 becomes the default + module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.env_info.PATH.append(bindir) From b100df80fa397369f5e12ae112c15fa898876770 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 8 Dec 2022 12:35:48 -0500 Subject: [PATCH 35/39] Apply suggestions from code review Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/cmake/3.x.x/conanfile.py | 1 - recipes/cmake/3.x.x/test_package/conanfile.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 971266ea6d846..2d9a52fa05e17 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -143,7 +143,6 @@ def package_info(self): self.cpp_info.libdirs = [] # Needed for compatibility with v1.x - Remmove when 2.0 becomes the default - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 58e759b923aa8..0dcb5b6b5032a 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -15,7 +15,7 @@ def test(self): if can_run(self): output = StringIO() # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it - self.run("cmake --version", output, env="conanbuild") + self.run("cmake --version", output) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) tokens = re.split('[@#]', self.tested_reference_str) From 7fa560adcf399c9b7318ccf90b7dd3d88bf310fc Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Thu, 8 Dec 2022 22:34:36 -0500 Subject: [PATCH 36/39] Added AutotoolsDeps generator; Eliminated can_run() from tests --- recipes/cmake/3.x.x/conanfile.py | 6 +++-- recipes/cmake/3.x.x/test_package/conanfile.py | 22 +++++++++---------- .../cmake/3.x.x/test_v1_package/conanfile.py | 20 ++++++++--------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 2d9a52fa05e17..14a62081ff4be 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.tools.files import chdir, copy, rmdir, get, save, load from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps from conan.tools.layout import basic_layout from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version @@ -85,6 +85,8 @@ def generate(self): if self.options.bootstrap: tc = AutotoolsToolchain(self) tc.generate() + tc = AutotoolsDeps(self) + tc.generate() bootstrap_cmake_options = ["--"] bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') if self.settings.os == "Linux": @@ -94,7 +96,7 @@ def generate(self): bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') else: bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") - save(self,"bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) + save(self, "bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) else: tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 0dcb5b6b5032a..fc365bdd36b31 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,6 +1,5 @@ from six import StringIO from conan import ConanFile -from conan.tools.build import can_run import re @@ -12,14 +11,13 @@ def build_requirements(self): self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it - self.run("cmake --version", output) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - tokens = re.split('[@#]', self.tested_reference_str) - require_version = tokens[0].split("/", 1)[1] - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it + self.run("cmake --version", output) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py index 4591d33b052b8..df9415b7cf880 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -1,7 +1,6 @@ import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run import re @@ -13,13 +12,12 @@ def build_requirements(self): self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - self.run("cmake --version", output=output, run_environment=False) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - tokens = re.split('[@#]', self.tested_reference_str) - require_version = tokens[0].split("/", 1)[1] - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + self.run("cmake --version", output=output, run_environment=False) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) From 3bf716f2f0aa789a50b357f9b9969e02835c3a44 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 12 Dec 2022 08:29:43 -0500 Subject: [PATCH 37/39] Correct msvc version Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/cmake/3.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 14a62081ff4be..fae2ed42429ad 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -54,7 +54,7 @@ def validate(self): "clang": "3.3", "apple-clang": "9", "Visual Studio": "14", - "msvc": "191", + "msvc": "190", } compiler = str(self.settings.compiler) From 8fa91aea3c8feeebca2f679768c80a6483823ddf Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:21:52 -0500 Subject: [PATCH 38/39] Use f-strings --- recipes/cmake/3.x.x/conanfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index fae2ed42429ad..96b67934a6d19 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -60,15 +60,15 @@ def validate(self): compiler = str(self.settings.compiler) if compiler not in minimal_version: self.output.warning( - "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) + f"{self.name} recipe lacks information about the {compiler} compiler standard version support") self.output.warning( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") return version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") def layout(self): if self.options.bootstrap: @@ -144,7 +144,7 @@ def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - # Needed for compatibility with v1.x - Remmove when 2.0 becomes the default + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) From 182c7d474ad40462e032d264c75de8aa64bf0da9 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Wed, 11 Jan 2023 09:02:14 -0500 Subject: [PATCH 39/39] Replace VirtualRunEnv with VirtualBuildEnv Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/cmake/3.x.x/test_package/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index fc365bdd36b31..df50a01c37d6f 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -5,7 +5,8 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualRunEnv" + generators = "VirtualBuildEnv" + test_type = "explicit" def build_requirements(self): self.tool_requires(self.tested_reference_str)