From e6c65d6c890a89e14e1ec18b7dbc778e6c2e0f68 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 20 Sep 2024 09:34:38 -0600 Subject: [PATCH] build: `MP_UNITS_BUILD_IMPORT_STD` CMake option removed --- conanfile.py | 1 - docs/getting_started/cpp_compiler_support.md | 2 +- docs/getting_started/installation_and_usage.md | 8 -------- src/CMakeLists.txt | 4 +--- src/core/CMakeLists.txt | 2 +- test_package/conanfile.py | 1 - 6 files changed, 3 insertions(+), 15 deletions(-) diff --git a/conanfile.py b/conanfile.py index 266a8acc..f7f3e97b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -266,7 +266,6 @@ class MPUnitsConan(ConanFile): 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" diff --git a/docs/getting_started/cpp_compiler_support.md b/docs/getting_started/cpp_compiler_support.md index c62e0393..d5eb5a34 100644 --- a/docs/getting_started/cpp_compiler_support.md +++ b/docs/getting_started/cpp_compiler_support.md @@ -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 diff --git a/docs/getting_started/installation_and_usage.md b/docs/getting_started/installation_and_usage.md index 3a59deac..d9fcbcb6 100644 --- a/docs/getting_started/installation_and_usage.md +++ b/docs/getting_started/installation_and_usage.md @@ -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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9c1fbb8..7449d678 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) @@ -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() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ce9db06b..1adba1e9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -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) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 73f188e1..d0ea2369 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -45,7 +45,6 @@ class TestPackageConan(ConanFile): 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"