2

I have a very simple script:

cmake_minimum_required(VERSION 4.0 FATAL_ERROR)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
set(CMAKE_CXX_MODULE_STD 1)
project(import_std LANGUAGES CXX)
add_executable(main)
target_sources(main PRIVATE main.cpp)
target_compile_features(main PRIVATE cxx_std_23 INTERFACE cxx_std_23)

But cmake seems to never actually enable the flag:

Experimental `import std` support not enabled when detecting toolchain; it must be set before `CXX` is enabled (usually a `project()` call)

Nothing really seems to let me get around this.

For context I'm using clang for compilation and lld for linking.

3
  • 1
    set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") - and what exactly does that UUID refer to? We can't just guess that.. Commented May 18 at 17:06
  • @JesperJuhl the UUID is from the cmake github repository, experimental features are turned on with a UUID that changes every version, you can find it here github.com/Kitware/CMake/blob/master/Help/dev/experimental.rst Commented May 18 at 20:12
  • 5
    The exact value of UUID for experimenting features depends on the version of cmake executable. Do you actually use CMake built from the sources? E.g if you use CMake of version 4.0.0, then UUID differs: github.com/Kitware/CMake/blob/v4.0.0/Help/dev/… Commented May 18 at 20:59

1 Answer 1

0

As Tsyvarev pointed out, i had simply used the wrong UUID, the UUID at main is not the same as the UUID of the latest release, i simply had to look in the v4.0.2 tag.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.