# Experimental support for \`import std;\` is incompatible with Clang's experimental library

**URL:** https://discourse.cmake.org/t/experimental-support-for-import-std-is-incompatible-with-clangs-experimental-library/14154
**Category:** Usage
**Created:** [May 25, 2025, 10:57pm UTC](https://discourse.cmake.org/t/experimental-support-for-import-std-is-incompatible-with-clangs-experimental-library/14154 "2025-05-25T22:57:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![aacfox](https://discourse.cmake.org/user_avatar/discourse.cmake.org/aacfox/32/5582_2.png) [@aacfox](https://discourse.cmake.org/u/aacfox)
#### Post date: [May 25, 2025, 10:57pm UTC](https://discourse.cmake.org/t/experimental-support-for-import-std-is-incompatible-with-clangs-experimental-library/14154/1 "2025-05-25T22:57:58Z")

</div>

To use clang’s experimental library one has to add `-fexperimental-library` compiler flag but that brokes otherwise perfectly working `import std;` and vice versa.

Here goes MRE:

```auto
# CMakeLists.txt
cmake_minimum_required(VERSION 4.0.2)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "a9e1cf81-9932-4810-974b-6eccaf14e457")
set(CMAKE_CXX_MODULE_STD 1)

project(main)
add_executable(main main.cxx)
target_compile_features(main PRIVATE cxx_std_23)
target_compile_options(main PRIVATE "-fexperimental-library")

// main.cxx
import std;
int main() {}

// Errors output when building with Ninja and Clang 20.1.5
[build] error: enable unstable and experimental library features was disabled in AST file 'CMakeFiles/__cmake_cxx23.dir/std.pcm' but is currently enabled
[build] error: module file CMakeFiles/__cmake_cxx23.dir/std.pcm cannot be loaded due to a configuration mismatch with the current compilation 

```

How can I resolve this mismatch? Is there a way to manually edit those configurations?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 26, 2025, 6:17am UTC](https://discourse.cmake.org/t/experimental-support-for-import-std-is-incompatible-with-clangs-experimental-library/14154/2 "2025-05-26T06:17:57Z")

</div>

CMake currently assumes all flags are compatible. See [this issue](https://gitlab.kitware.com/cmake/cmake/-/issues/25916) for computing flags for BMIs based on consumers (which this falls into).
