Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtest: set the correct required_conan_version + few minor fixes #13121

Merged
merged 5 commits into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions recipes/gtest/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.51.1"


class GTestConan(ConanFile):
Expand Down Expand Up @@ -37,7 +37,7 @@ class GTestConan(ConanFile):

@property
def _minimum_cpp_standard(self):
return 11
return 11

@property
def _minimum_compilers_version(self):
Expand All @@ -59,19 +59,22 @@ def config_options(self):

def configure(self):
if self.options.shared:
del self.options.fPIC
try:
del self.options.fPIC
except Exception:
pass
if self.options.debug_postfix != "deprecated":
self.output.warn("gtest/*:debug_postfix is deprecated.")

def layout(self):
cmake_layout(self, src_folder="src")

def package_id(self):
del self.info.options.no_main # Only used to expose more targets
del self.info.options.debug_postfix # deprecated option that no longer exist

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.options.shared and (is_msvc(self) or self._is_clang_cl) and is_msvc_static_runtime(self):
if self.info.options.shared and (is_msvc(self) or self._is_clang_cl) and is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(
"gtest:shared=True with compiler=\"Visual Studio\" is not "
"compatible with compiler.runtime=MT/MTd"
Expand All @@ -93,6 +96,9 @@ def loose_lt_semver(v1, v2):
f"{self.ref} requires {compiler} {min_version}. The current compiler is {compiler} {compiler.version}."
)

def source(self):
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
Expand All @@ -105,9 +111,6 @@ def generate(self):
tc.variables["gtest_disable_pthreads"] = True
tc.generate()

def source(self):
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)

def _patch_sources(self):
if is_msvc(self) or self._is_clang_cl:
# No warnings as errors
Expand Down