mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
build: mp::units
CMake target was a bad idea -> mp-units::mp-units
is back
This commit is contained in:
35
conanfile.py
35
conanfile.py
@@ -67,19 +67,22 @@ class UnitsConan(ConanFile):
|
||||
# }
|
||||
generators = "cmake_paths"
|
||||
|
||||
_cmake = None
|
||||
|
||||
@property
|
||||
def _run_tests(self):
|
||||
return tools.get_env("CONAN_RUN_TESTS", False)
|
||||
|
||||
def _configure_cmake(self):
|
||||
cmake = CMake(self)
|
||||
if self._run_tests:
|
||||
# developer's mode (unit tests, examples, documentation, restrictive compilation warnings, ...)
|
||||
cmake.configure()
|
||||
else:
|
||||
# consumer's mode (library sources only)
|
||||
cmake.configure(source_folder="src")
|
||||
return cmake
|
||||
if not self._cmake:
|
||||
self._cmake = CMake(self)
|
||||
if self._run_tests:
|
||||
# developer's mode (unit tests, examples, documentation, restrictive compilation warnings, ...)
|
||||
self._cmake.configure()
|
||||
else:
|
||||
# consumer's mode (library sources only)
|
||||
self._cmake.configure(source_folder="src")
|
||||
return self._cmake
|
||||
|
||||
def validate(self):
|
||||
compiler = self.settings.compiler
|
||||
@@ -132,20 +135,8 @@ class UnitsConan(ConanFile):
|
||||
self.info.header_only()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.filenames["cmake_find_package"] = "mp-units"
|
||||
self.cpp_info.filenames["cmake_find_package_multi"] = "mp-units"
|
||||
self.cpp_info.names["cmake_find_package"] = "mp"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "mp"
|
||||
self.cpp_info.components["units"].name = "units"
|
||||
self.cpp_info.components["units"].requires = ["fmt::fmt", "gsl-lite::gsl-lite"]
|
||||
|
||||
compiler = self.settings.compiler
|
||||
version = Version(self.settings.compiler.version)
|
||||
if compiler == "gcc":
|
||||
self.cpp_info.components["units"].cxxflags = [
|
||||
"-Wno-non-template-friend"
|
||||
]
|
||||
self.cpp_info.cxxflags = ["-Wno-non-template-friend"]
|
||||
elif compiler == "Visual Studio":
|
||||
self.cpp_info.components["units"].cxxflags = [
|
||||
"/utf-8"
|
||||
]
|
||||
self.cpp_info.cxxflags = ["/utf-8"]
|
||||
|
@@ -17,7 +17,6 @@
|
||||
- (!) fix: `dim_torque` now properly divides by an angle (instead of multiply) + default unit name change
|
||||
- fix: `quantity_cast()` fixed to work correctly with representation types not convertible from `std::intmax_t`
|
||||
- fix: ambiguous case for empty type list resolved
|
||||
- (!) build: The library should now be linked as `mp::units` in the CMake's `target_link_libraries()`
|
||||
- (!) build: `BUILD_DOCS` CMake option renamed to `UNITS_BUILD_DOCS`
|
||||
- build: doxygen updated to 1.8.20
|
||||
- build: catch2 updated to 2.13.4
|
||||
|
@@ -193,7 +193,7 @@ defined by the library. To do so you should use *CMakeLists.txt* file from the *
|
||||
|
||||
add_subdirectory(<path_to_units_folder>/src)
|
||||
# ...
|
||||
target_link_libraries(<your_target> PUBLIC|PRIVATE|INTERFACE mp::units)
|
||||
target_link_libraries(<your_target> PUBLIC|PRIVATE|INTERFACE mp-units::mp-units)
|
||||
|
||||
.. important::
|
||||
|
||||
@@ -238,7 +238,7 @@ library release the following steps may be performed:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
target_link_libraries(<your_target> PUBLIC|PRIVATE|INTERFACE mp::units)
|
||||
target_link_libraries(<your_target> PUBLIC|PRIVATE|INTERFACE mp-units::mp-units)
|
||||
target_compile_features(<your_target> PUBLIC|PRIVATE|INTERFACE cxx_std_20)
|
||||
|
||||
.. important::
|
||||
|
@@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
function(add_example target)
|
||||
add_executable(${target} ${target}.cpp)
|
||||
target_link_libraries(${target} PRIVATE mp::units)
|
||||
target_link_libraries(${target} PRIVATE mp-units::mp-units)
|
||||
endfunction()
|
||||
|
||||
add_example(box_example)
|
||||
|
@@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
function(add_example target)
|
||||
add_executable(${target}_alt ${target}.cpp)
|
||||
target_link_libraries(${target}_alt PRIVATE mp::units)
|
||||
target_link_libraries(${target}_alt PRIVATE mp-units::mp-units)
|
||||
endfunction()
|
||||
|
||||
add_example(box_example)
|
||||
|
@@ -78,8 +78,7 @@ if(DEFINED UNITS_DOWNCAST_MODE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(mp::units ALIAS mp-units)
|
||||
set_target_properties(mp-units PROPERTIES EXPORT_NAME units)
|
||||
add_library(mp-units::mp-units ALIAS mp-units)
|
||||
|
||||
# installation info
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
@@ -34,7 +34,7 @@ add_executable(unit_tests_runtime
|
||||
)
|
||||
target_link_libraries(unit_tests_runtime
|
||||
PRIVATE
|
||||
mp::units
|
||||
mp-units::mp-units
|
||||
Catch2::Catch2
|
||||
)
|
||||
|
||||
|
@@ -49,5 +49,5 @@ add_library(unit_tests_static
|
||||
)
|
||||
target_link_libraries(unit_tests_static
|
||||
PRIVATE
|
||||
mp::units
|
||||
mp-units::mp-units
|
||||
)
|
||||
|
@@ -26,4 +26,4 @@ project(test_package)
|
||||
find_package(mp-units CONFIG REQUIRED)
|
||||
|
||||
add_executable(test_package test_package.cpp)
|
||||
target_link_libraries(test_package PRIVATE mp::units)
|
||||
target_link_libraries(test_package PRIVATE mp-units::mp-units)
|
||||
|
Reference in New Issue
Block a user