Commit 595ebc22 authored by David Yip's avatar David Yip

Make Conan test package use LTO if the library uses LTO

This is required by clang's ThinLTO mode, which generates static
libraries that contain data not recognizable by the test package
executable's linker unless it is also told to run in ThinLTO mode.
parent ec7c3cef
......@@ -6,12 +6,25 @@ from conans import ConanFile, CMake, tools
class SemvercTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
options = {
"lto": [True, False],
"fPIC": [True, False]
def config_options(self):
self.options.lto = self.options["semver.c"].lto
self.options.fPIC = self.options["semver.c"].fPIC
def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake.definitions["CMAKE_INTERPROCEDURAL_OPTIMIZATION"] = self.options.lto
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.fPIC
if self.options.lto:
cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0069"] = "NEW"
def imports(self):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment