From 601da43478f2e11b014a11c931c3206aadb783cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 16 Dec 2024 20:48:11 +0100 Subject: [PATCH] Sketch cmake_config_version property --- conan/tools/cmake/cmakedeps/templates/config_version.py | 1 + conan/tools/cmake/cmakedeps2/config_version.py | 1 + 2 files changed, 2 insertions(+) diff --git a/conan/tools/cmake/cmakedeps/templates/config_version.py b/conan/tools/cmake/cmakedeps/templates/config_version.py index db42be948a7..2f41e935a02 100644 --- a/conan/tools/cmake/cmakedeps/templates/config_version.py +++ b/conan/tools/cmake/cmakedeps/templates/config_version.py @@ -26,6 +26,7 @@ def context(self): if policy not in ("AnyNewerVersion", "SameMajorVersion", "SameMinorVersion", "ExactVersion"): raise ConanException(f"Unknown cmake_config_version_compat={policy} in {self.conanfile}") version = self.cmakedeps.get_property("system_package_version", self.conanfile) + version = version or self.cmakedeps.get_property("cmake_config_version", self.conanfile) version = version or self.conanfile.ref.version return {"version": version, "policy": policy} diff --git a/conan/tools/cmake/cmakedeps2/config_version.py b/conan/tools/cmake/cmakedeps2/config_version.py index 4a3212ba21c..8c482af5dfd 100644 --- a/conan/tools/cmake/cmakedeps2/config_version.py +++ b/conan/tools/cmake/cmakedeps2/config_version.py @@ -32,6 +32,7 @@ def _context(self): if policy not in ("AnyNewerVersion", "SameMajorVersion", "SameMinorVersion", "ExactVersion"): raise ConanException(f"Unknown cmake_config_version_compat={policy} in {self._conanfile}") version = self._cmakedeps.get_property("system_package_version", self._conanfile) + version = version or self._cmakedeps.get_property("cmake_config_version", self._conanfile) version = version or self._conanfile.ref.version return {"version": version, "policy": policy}