build: package_type is dynamically set in conanfile.py depending if we build modules or not

This commit is contained in:
Mateusz Pusz
2024-09-27 07:53:13 +02:00
parent 562c2e1ea1
commit 5f2cb78037
2 changed files with 8 additions and 4 deletions

View File

@ -68,6 +68,7 @@
- build: `generate()` in `test_package` now correctly propagates project's options - build: `generate()` in `test_package` now correctly propagates project's options
- build: `target_include_directories` is not needed anymore - build: `target_include_directories` is not needed anymore
- build: `target_compile_features` now uses `CMAKE_CXX_STANDARD` - build: `target_compile_features` now uses `CMAKE_CXX_STANDARD`
- build: `package_type` is dynamically set in conanfile.py depending if we build modules or not
- ci: added test for upstream clang on macos-14, as an example for an arm64 platform by [@burnpanck](https://github.com/burnpanck) - ci: added test for upstream clang on macos-14, as an example for an arm64 platform by [@burnpanck](https://github.com/burnpanck)
- style: pre-commit updated to clang-format-18.1.8 - style: pre-commit updated to clang-format-18.1.8
- docs: "Strong Angular System" chapter added - docs: "Strong Angular System" chapter added

View File

@ -82,7 +82,6 @@ class MPUnitsConan(ConanFile):
"example/*", "example/*",
"CMakeLists.txt", "CMakeLists.txt",
) )
package_type = "header-library"
no_copy_source = True no_copy_source = True
@property @property
@ -204,17 +203,21 @@ class MPUnitsConan(ConanFile):
self._set_default_option(key) self._set_default_option(key)
def configure(self): def configure(self):
if self.options.cxx_modules:
self.package_type = "static-library"
else:
self.package_type = "header-library"
if self.options.freestanding: if self.options.freestanding:
self.options.rm_safe("std_format") self.options.rm_safe("std_format")
def requirements(self): def requirements(self):
if not self.options.freestanding: if not self.options.freestanding:
if self.options.contracts == "gsl-lite": if self.options.contracts == "gsl-lite":
self.requires("gsl-lite/0.41.0") self.requires("gsl-lite/0.41.0", transitive_headers=True)
elif self.options.contracts == "ms-gsl": elif self.options.contracts == "ms-gsl":
self.requires("ms-gsl/4.0.0") self.requires("ms-gsl/4.0.0", transitive_headers=True)
if not self.options.std_format: if not self.options.std_format:
self.requires("fmt/11.0.1") self.requires("fmt/11.0.1", transitive_headers=True)
def build_requirements(self): def build_requirements(self):
self.tool_requires("cmake/[>=3.30 <4]") self.tool_requires("cmake/[>=3.30 <4]")