build: 💥 MP_UNITS_BUILD_LA and MP_UNITS_IWYU CMake options now have _DEV_ in the name

This commit is contained in:
Mateusz Pusz
2024-04-12 09:43:02 +02:00
parent 5036a3e0e0
commit 7b57ce5ab1
4 changed files with 11 additions and 13 deletions

View File

@@ -27,8 +27,8 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
set(projectPrefix MP_UNITS_)
option(${projectPrefix}BUILD_LA "Build code depending on the linear algebra library" ON)
message(STATUS "${projectPrefix}BUILD_LA: ${${projectPrefix}BUILD_LA}")
option(${projectPrefix}DEV_BUILD_LA "Build code depending on the linear algebra library" ON)
message(STATUS "${projectPrefix}DEV_BUILD_LA: ${${projectPrefix}DEV_BUILD_LA}")
# make sure that the file is being used as an entry point
include(modern_project_structure)
@@ -43,9 +43,9 @@ include(warnings)
set_warnings()
# enable include-what-you-use
option(${projectPrefix}IWYU "Enables include-what-you-use" OFF)
option(${projectPrefix}DEV_IWYU "Enables include-what-you-use" OFF)
if(${projectPrefix}IWYU)
if(${projectPrefix}DEV_IWYU)
include(include-what-you-use)
enable_iwyu(
MAPPING_FILE "${PROJECT_SOURCE_DIR}/.mp-units.imp"
@@ -53,10 +53,6 @@ if(${projectPrefix}IWYU)
MAX_LINE_LENGTH 120
NO_COMMENTS
)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(${projectPrefix}AS_SYSTEM_HEADERS ON)
endif()
endif()
# enable_clang_tidy()

View File

@@ -151,7 +151,9 @@ class MPUnitsConan(ConanFile):
if self.options.cxx_modules:
tc.cache_variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True
tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True
tc.cache_variables["MP_UNITS_BUILD_LA"] = self._build_all and not self._skip_la
tc.cache_variables["MP_UNITS_DEV_BUILD_LA"] = (
self._build_all and not self._skip_la
)
tc.cache_variables["MP_UNITS_USE_FMTLIB"] = bool(self.options.use_fmtlib)
tc.generate()
deps = CMakeDeps(self)

View File

@@ -239,8 +239,9 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
[use fmtlib support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
#### Options for mp-units project developers
[`MP_UNITS_BUILD_LA`](#MP_UNITS_BUILD_LA){ #MP_UNITS_BUILD_LA }
[`MP_UNITS_DEV_BUILD_LA`](#MP_UNITS_DEV_BUILD_LA){ #MP_UNITS_DEV_BUILD_LA }
: [:octicons-tag-24: 2.0.0][build la support] · :octicons-milestone-24: `ON`/`OFF` (Default: `ON`)
@@ -249,12 +250,11 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"}
[build la support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0
[`MP_UNITS_IWYU`](#MP_UNITS_IWYU){ #MP_UNITS_IWYU }
[`MP_UNITS_DEV_IWYU`](#MP_UNITS_DEV_IWYU){ #MP_UNITS_DEV_IWYU }
: [:octicons-tag-24: 2.0.0][iwyu support] · :octicons-milestone-24: `ON`/`OFF` (Default: `OFF`)
Enables `include-what-you-use` when compiling with a clang compiler.
Additionally turns on [`MP_UNITS_AS_SYSTEM_HEADERS`](#MP_UNITS_AS_SYSTEM_HEADERS).
[iwyu support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0

View File

@@ -30,7 +30,7 @@ if(${projectPrefix}BUILD_CXX_MODULES)
endif()
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2WithMain)
if(${projectPrefix}BUILD_LA)
if(${projectPrefix}DEV_BUILD_LA)
find_package(wg21_linear_algebra REQUIRED)
target_sources(unit_tests_runtime PRIVATE linear_algebra_test.cpp)
target_link_libraries(unit_tests_runtime PRIVATE wg21_linear_algebra::wg21_linear_algebra)