Skip to content

Commit

Permalink
build: MP_UNITS_BUILD_IMPORT_STD CMake option removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Sep 20, 2024
1 parent 7f0dea9 commit e6c65d6
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 15 deletions.
1 change: 0 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def generate(self):
tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True
if self.options.import_std:
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`
tc.cache_variables[
"CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/cpp_compiler_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ C++ feature:
`import std;` instead of the "old-style" header includes.
- Related build options:
- 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
Expand Down
8 changes: 0 additions & 8 deletions docs/getting_started/installation_and_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

[`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 }

: [:octicons-tag-24: 2.2.0][cmake std::format support] · :octicons-milestone-24: `ON`/`OFF` (Default: automatically determined)
Expand Down
4 changes: 1 addition & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ check_libcxx_in_use(${projectPrefix}LIBCXX)
# project build options
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_IMPORT_STD "Enable `import std;` usage" OFF)

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_IMPORT_STD: ${${projectPrefix}BUILD_IMPORT_STD}")

if(${projectPrefix}BUILD_AS_SYSTEM_HEADERS)
set(${projectPrefix}_AS_SYSTEM SYSTEM)
Expand Down Expand Up @@ -126,7 +124,7 @@ else()
set(${projectPrefix}TARGET_SCOPE "INTERFACE")
endif()

if(${projectPrefix}BUILD_IMPORT_STD)
if(CMAKE_CXX_MODULE_STD)
if(CMAKE_VERSION VERSION_LESS "3.30")
message(FATAL_ERROR "CMake versions before 3.30 do not support `import std;` properly")
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ if(${projectPrefix}BUILD_CXX_MODULES)
endif()
endif()

if(${projectPrefix}BUILD_IMPORT_STD)
if(CMAKE_CXX_MODULE_STD)
target_compile_definitions(mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}IMPORT_STD)
# https://github.com/llvm/llvm-project/issues/75057
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
Expand Down
1 change: 0 additions & 1 deletion test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def generate(self):
tc.cache_variables["MP_UNITS_BUILD_CXX_MODULES"] = True
if opt.import_std:
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`
tc.cache_variables[
"CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"
Expand Down

0 comments on commit e6c65d6

Please sign in to comment.