diff --git a/recipes/geographiclib/all/conandata.yml b/recipes/geographiclib/all/conandata.yml index cdc1dfb721a05..13c1e395dbf37 100644 --- a/recipes/geographiclib/all/conandata.yml +++ b/recipes/geographiclib/all/conandata.yml @@ -2,4 +2,6 @@ sources: "1.50.1": url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.50.1.tar.gz" sha256: "d1765009e068b8cc5e76957e5d6be45ce6cff08c4aad8e5995e84a28354385f1" - + "1.51": + url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.51.tar.gz" + sha256: "34370949617df5105bd6961e0b91581aef758dc455fe8629eb5858516022d310" diff --git a/recipes/geographiclib/all/conanfile.py b/recipes/geographiclib/all/conanfile.py index 3ebcbcb3a8abd..82d69fd739f4e 100644 --- a/recipes/geographiclib/all/conanfile.py +++ b/recipes/geographiclib/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.28.0" @@ -23,9 +24,34 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + @property + def _min_compiler_version_default_cxx11(self): + # Minimum compiler version having c++ standard >= 11 + return { + "apple-clang": "3.3", + "gcc": "4.9", + "clang": "6", + "Visual Studio": "14", # guess + }.get(str(self.settings.compiler), False) + def configure(self): if self.options.shared: del self.options.fPIC + if tools.Version(self.version) >= "1.51": + if self.settings.compiler.cppstd: + tools.min_cppstd(self, 11) + + def lazy_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._min_compiler_version_default_cxx11 + if not minimum_version: + self.output.warn("geographiclib {} requires C++11 math functions. Your compiler is unknown. Assuming it supports this feature.".format(self.version)) + elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration("geographiclib {} requires C++11 math functions, which your compiler does not support.".format(self.version)) def source(self): tools.get(**self.conan_data["sources"][self.version]) diff --git a/recipes/geographiclib/all/test_package/CMakeLists.txt b/recipes/geographiclib/all/test_package/CMakeLists.txt index dd75e3882411a..8072fb794b8d8 100644 --- a/recipes/geographiclib/all/test_package/CMakeLists.txt +++ b/recipes/geographiclib/all/test_package/CMakeLists.txt @@ -8,3 +8,7 @@ find_package(geographiclib CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} GeographicLib::GeographicLib) + +if(geographiclib_VERSION VERSION_GREATER_EQUAL "1.51") + set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +endif() diff --git a/recipes/geographiclib/config.yml b/recipes/geographiclib/config.yml index d022c390287d3..65cd32bf8e28d 100644 --- a/recipes/geographiclib/config.yml +++ b/recipes/geographiclib/config.yml @@ -1,3 +1,5 @@ versions: "1.50.1": folder: all + "1.51": + folder: all