Repository: google/benchmark
File: conanfile.py (Python)

Code before:

    def _configure_cmake(self):
        cmake = CMake(self)

        if tools.get_env("CONAN_RUN_TESTS"):
            cmake.definitions["BENCHMARK_ENABLE_TESTING"] = "ON"
            cmake.definitions["BENCHMARK_ENABLE_GTEST_TESTS"] = "ON" if self.options.enable_gtest_tests else "OFF"
        else:
            cmake.definitions["BENCHMARK_ENABLE_TESTING"] = "OFF"
            cmake.definitions["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF"

        cmake.definitions["BENCHMARK_ENABLE_LTO"] = "ON" if self.options.enable_lto else "OFF"
        cmake.definitions["BENCHMARK_ENABLE_EXCEPTIONS"] = "ON" if self.options.enable_exceptions else "OFF"

        # See https://github.com/google/benchmark/pull/638 for Windows 32 build explanation
        if self.settings.os != "Windows":
            cmake.definitions["BENCHMARK_BUILD_32_BITS"] = "ON" if "64" not in str(self.settings.arch) else "OFF"
            cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if (str(self.settings.compiler.libcxx) == "libc++") else "OFF"
        else:
            cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF"

        cmake.configure(build_folder=self._build_subfolder)
        return cmake

    def build_requirements(self):
        if tools.get_env("CONAN_RUN_TESTS") and self.options.enable_gtest_tests:
            self.build_requires("gtest/1.8.0@bincrafters/stable")

    def build(self):
        cmake = self._configure_cmake()
        cmake.build()

    def package(self):
        cmake = self._configure_cmake()
        cmake.install()

        self.copy(pattern="LICENSE", dst="licenses")

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)
        if self.settings.os == "Linux":
            self.cpp_info.libs.extend(["pthread", "rt"])
        elif self.settings.os == "Windows":
            self.cpp_info.libs.append("shlwapi")
        elif self.settings.os == "SunOS":
            self.cpp_info.libs.append("kstat")

    def package_id(self):
        # Development options don't change the binary output
        # from a user point of view; overwrite id information
        # so that the package_id is the same

Review comment (suggestion):
This line looks kind of weird to me but having a look at `BENCHMARK_ENABLE_TESTING` and `BENCHMARK_ENABLE_GTEST_TESTS` it could make sense to have it separated. Anyway both the option and env var for tests are well managed

Code after:
        cmake.definitions["BENCHMARK_ENABLE_LTO"] = "ON" if self.options.enable_lto else "OFF"
        cmake.definitions["BENCHMARK_ENABLE_EXCEPTIONS"] = "ON" if self.options.enable_exceptions else "OFF"

        # See https://github.com/google/benchmark/pull/638 for Windows 32 build explanation
        if self.settings.os != "Windows":
            cmake.definitions["BENCHMARK_BUILD_32_BITS"] = "ON" if "64" not in str(self.settings.arch) else "OFF"
            cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if (str(self.settings.compiler.libcxx) == "libc++") else "OFF"
        else:
            cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF"

        cmake.configure(build_folder=self._build_subfolder)
        return cmake

    def build(self):
        cmake = self._configure_cmake()
        cmake.build()

    def package(self):
        cmake = self._configure_cmake()
        cmake.install()

        self.copy(pattern="LICENSE", dst="licenses")

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)
        if self.settings.os == "Linux":
            self.cpp_info.libs.extend(["pthread", "rt"])
        elif self.settings.os == "Windows":
            self.cpp_info.libs.append("shlwapi")
        elif self.settings.os == "SunOS":
            self.cpp_info.libs.append("kstat")