C++26 contracts

How will cmake deal with this ?
For example on gcc, one has to specify both ‘-fcontracts’ both to the compiler, and to the linker.

No idea what the option will be for clang or MSVC.

Will this be left to the user, or will cmake foresee an abstraction (a per target property, default by a global CMAKE_xxx property) ?

And how about specifying the standard semantic (ignore/observe/enforce ,quick_enforce) ?

Historically CMake does not add mechanisms for experimental compiler features.

For example, -lstdc++fs for std::filesystem was never given an abstraction, nor are there plans to support -freflection.

It is unlikely -fcontracts will be treated differently.

The enforcement semantic is a different story. Once compilers have stable implementations and interfaces for enforcement semantics, some collection of properties will likely need to be implemented for them.

1 Like