build: MP_UNITS_BUILD_IMPORT_STD CMake option removed

This commit is contained in:
Mateusz Pusz
2024-09-20 09:34:38 -06:00
parent 7f0dea9d18
commit e6c65d6c89
6 changed files with 3 additions and 15 deletions

View File

@ -266,7 +266,6 @@ class MPUnitsConan(ConanFile):
tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True
if self.options.import_std: if self.options.import_std:
tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True
tc.cache_variables["MP_UNITS_BUILD_IMPORT_STD"] = True
# Current experimental support according to `Help/dev/experimental.rst` # Current experimental support according to `Help/dev/experimental.rst`
tc.cache_variables[ tc.cache_variables[
"CMAKE_EXPERIMENTAL_CXX_IMPORT_STD" "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"

View File

@ -84,7 +84,7 @@ C++ feature:
`import std;` instead of the "old-style" header includes. `import std;` instead of the "old-style" header includes.
- Related build options: - Related build options:
- Conan: [import_std](installation_and_usage.md#import_std) - Conan: [import_std](installation_and_usage.md#import_std)
- CMake: [MP_UNITS_BUILD_IMPORT_STD](installation_and_usage.md#MP_UNITS_BUILD_IMPORT_STD) - CMake: [CMAKE_CXX_MODULE_STD](https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_MODULE_STD.html)
## Static `constexpr` variables in `constexpr` functions ## Static `constexpr` variables in `constexpr` functions

View File

@ -186,14 +186,6 @@ dependencies by other means, some modifications to the library's CMake files mig
[cmake build cxx modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 [cmake build cxx modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0
[`MP_UNITS_BUILD_IMPORT_STD`](#MP_UNITS_BUILD_IMPORT_STD){ #MP_UNITS_BUILD_IMPORT_STD }
: [:octicons-tag-24: 2.3.0][cmake import std support] · :octicons-milestone-24: `ON`/`OFF` (Default: `OFF`)
Enables `import std;` usage.
[cmake import std support]: https://github.com/mpusz/mp-units/releases/tag/v2.3.0
[`MP_UNITS_API_STD_FORMAT`](#MP_UNITS_API_STD_FORMAT){ #MP_UNITS_API_STD_FORMAT } [`MP_UNITS_API_STD_FORMAT`](#MP_UNITS_API_STD_FORMAT){ #MP_UNITS_API_STD_FORMAT }
: [:octicons-tag-24: 2.2.0][cmake std::format support] · :octicons-milestone-24: `ON`/`OFF` (Default: automatically determined) : [:octicons-tag-24: 2.2.0][cmake std::format support] · :octicons-milestone-24: `ON`/`OFF` (Default: automatically determined)

View File

@ -38,11 +38,9 @@ check_libcxx_in_use(${projectPrefix}LIBCXX)
# project build options # project build options
option(${projectPrefix}BUILD_AS_SYSTEM_HEADERS "Export library as system headers" OFF) option(${projectPrefix}BUILD_AS_SYSTEM_HEADERS "Export library as system headers" OFF)
option(${projectPrefix}BUILD_CXX_MODULES "Add C++ modules to the list of default targets" OFF) option(${projectPrefix}BUILD_CXX_MODULES "Add C++ modules to the list of default targets" OFF)
option(${projectPrefix}BUILD_IMPORT_STD "Enable `import std;` usage" OFF)
message(STATUS "${projectPrefix}BUILD_AS_SYSTEM_HEADERS: ${${projectPrefix}BUILD_AS_SYSTEM_HEADERS}") message(STATUS "${projectPrefix}BUILD_AS_SYSTEM_HEADERS: ${${projectPrefix}BUILD_AS_SYSTEM_HEADERS}")
message(STATUS "${projectPrefix}BUILD_CXX_MODULES: ${${projectPrefix}BUILD_CXX_MODULES}") message(STATUS "${projectPrefix}BUILD_CXX_MODULES: ${${projectPrefix}BUILD_CXX_MODULES}")
message(STATUS "${projectPrefix}BUILD_IMPORT_STD: ${${projectPrefix}BUILD_IMPORT_STD}")
if(${projectPrefix}BUILD_AS_SYSTEM_HEADERS) if(${projectPrefix}BUILD_AS_SYSTEM_HEADERS)
set(${projectPrefix}_AS_SYSTEM SYSTEM) set(${projectPrefix}_AS_SYSTEM SYSTEM)
@ -126,7 +124,7 @@ else()
set(${projectPrefix}TARGET_SCOPE "INTERFACE") set(${projectPrefix}TARGET_SCOPE "INTERFACE")
endif() endif()
if(${projectPrefix}BUILD_IMPORT_STD) if(CMAKE_CXX_MODULE_STD)
if(CMAKE_VERSION VERSION_LESS "3.30") if(CMAKE_VERSION VERSION_LESS "3.30")
message(FATAL_ERROR "CMake versions before 3.30 do not support `import std;` properly") message(FATAL_ERROR "CMake versions before 3.30 do not support `import std;` properly")
endif() endif()

View File

@ -125,7 +125,7 @@ if(${projectPrefix}BUILD_CXX_MODULES)
endif() endif()
endif() endif()
if(${projectPrefix}BUILD_IMPORT_STD) if(CMAKE_CXX_MODULE_STD)
target_compile_definitions(mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}IMPORT_STD) target_compile_definitions(mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}IMPORT_STD)
# https://github.com/llvm/llvm-project/issues/75057 # https://github.com/llvm/llvm-project/issues/75057
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)

View File

@ -45,7 +45,6 @@ class TestPackageConan(ConanFile):
tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True
if opt.import_std: if opt.import_std:
tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True
tc.cache_variables["MP_UNITS_BUILD_IMPORT_STD"] = True
# Current experimental support according to `Help/dev/experimental.rst` # Current experimental support according to `Help/dev/experimental.rst`
tc.cache_variables[ tc.cache_variables[
"CMAKE_EXPERIMENTAL_CXX_IMPORT_STD" "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"