Skip to content

Automatically update the CXX_STANDARD #64248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Mar 9, 2023

Folks are running into issues updating because the CXX standard is cached and we updated it. This patch allows CMake to update it to a minimum required version for Swift. If it's in the cache and too low, it will update it. If it's manually specified and too low, it will give a fatal error letting the dev know it's too low.

message(FATAL_ERROR "Requested CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} which is less than the minimum C++ standard ${SWIFT_MIN_CXX_STANDARD}")
endif()

set(CMAKE_CXX_STANDARD ${SWIFT_MIN_CXX_STANDARD} CACHE STRING "C++ standard to conform to")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not need to be forced?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unset(CMAKE_CXX_STANDARD) will override it. I didn't wan't to force it in case someone did -DCMAKE_CXX_STANDARD=42 or had it set in some other way.

I think this is almost identical to how LLVM is handling the update now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Correction: unset will remove it from the cache and let the CACHE var write it back with the new value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@etcwilde etcwilde force-pushed the ewilde/i-have-standards-you-know branch from fe1ecb1 to 32f0498 Compare March 9, 2023 19:09
Folks are running into issues updating because the CXX standard is
cached and we updated it. This patch allows CMake to update it to a
minimum required version for Swift. If it's in the cache and too low, it
will update it. If it's manually specified and too low, it will give a
fatal error letting the dev know it's too low.
@etcwilde etcwilde force-pushed the ewilde/i-have-standards-you-know branch from 32f0498 to e695385 Compare March 9, 2023 19:12
@etcwilde
Copy link
Member Author

etcwilde commented Mar 9, 2023

@swift-ci please smoke test

@etcwilde
Copy link
Member Author

etcwilde commented Mar 9, 2023

Windows failure looks like update-checkout issues.

@etcwilde
Copy link
Member Author

etcwilde commented Mar 9, 2023

@swift-ci please smoke test windows

@etcwilde etcwilde merged commit e202801 into swiftlang:main Mar 10, 2023
@etcwilde etcwilde deleted the ewilde/i-have-standards-you-know branch April 2, 2023 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants