CMAKE_EXPERIMENTAL_CXX_IMPORT_STD value history and state

AFAIK, this is are the current rules to activate import std; with last stable CMake versions:

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0")
    if(CMAKE_VERSION VERSION_LESS "3.31.8")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "0e5b6991-d74f-4b3d-a41c-cf096e0b2508"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.0.0")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "d0edc3af-4c50-42ea-a356-e2862fe7a444"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.0.3")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "a9e1cf81-9932-4810-974b-6eccaf14e457"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.3.0")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "d0edc3af-4c50-42ea-a356-e2862fe7a444"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.4.0")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "451f2fe2-a8a2-47c3-bc32-94786d8fc91b"
        )
    endif()
endif()
  • Is it really necessary to change the UUID in this way?
  • What is planed to be the right value for CMake v4.4.0?
  • I wonder if a UUID value from the experimental gate must be changed at all?

Anytime we change the behavior of the experimental feature, the UUID is recycled. This is because behavior changes can break existing code, contrary to CMake’s typical compatibility guarantees.

I’m not aware of any pending changes that would change 4.4’s UUID, but that doesn’t mean we won’t fix bugs (and change the UUID in the process) if they come up.

2 Likes

update:

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.4.0")
    set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
        "f35a9ac6-8463-4d38-8eec-5d6008153e7d"
    )
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "4.3.0")
    set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
        "451f2fe2-a8a2-47c3-bc32-94786d8fc91b"
    )
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.30.0")
    if(CMAKE_VERSION VERSION_LESS "3.31.8")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "0e5b6991-d74f-4b3d-a41c-cf096e0b2508"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.0.0")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "d0edc3af-4c50-42ea-a356-e2862fe7a444"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.0.3")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "a9e1cf81-9932-4810-974b-6eccaf14e457"
        )
    elseif(CMAKE_VERSION VERSION_LESS "4.3.0")
        set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
            "d0edc3af-4c50-42ea-a356-e2862fe7a444"
        )
    endif()
endif()

Why not make a simpler way to enable experimental features, for example set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD ON)?

1 Like

There is an issue about dropping these magic uuids completely as the feature itself had already grown maturely: https://gitlab.kitware.com/cmake/cmake/-/work_items/28014 - but it’s not clear abour 4.5 time frame (it is scheduled on the October)

From Help/dev/experimental.rst:

the specific values will change over time to reinforce their experimental nature.

As an experimental feature develops, breaking changes are allowed and come with a UUID update. In order for people trying it to distinguish between “this experimental feature doesn’t work” and “this project isn’t aware of a breaking change”, a project must explicitly specify the UUID of which it is aware.

1 Like