-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[build-script] Clear CMakeCache.txt before (re)configuration. #2226
Conversation
803c636
to
6f1d5bf
Compare
set -x | ||
mkdir -p "${build_dir}" | ||
rm -f "${cmake_cache_path}" | ||
(cd "${build_dir}" && "${CMAKE}" "${cmake_options[@]}" ${USER_CONFIG_ARGS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved mkdir
inside -x
block because, I think, any operation that might mutates the file system should be visible from us.
@rintaro Thank you, this looks like a good idea to me! Do you know if this is the recommended way to clear configuration for CMake? Does it have any bad effects? Does it still allow incremental builds? |
I don't know for "recommended way to clear configuration", but in general, hand-editing or deleting CMakeCache.txt is supported way.
It may. Inside CMakeLists.txt, consider:
Obviously, this kind of problem should be fixed in CMakeLists.txt. Since it's supported way, I believe cmake itself or core components must not have these kind of problem.
Sorry, but I don't know for now. |
Thank you, this is exactly what I was looking for! So the developers are recommending deleting the file, we should be good.
I just ran a quick test on the master branch:
So we should be good. |
@swift-ci Please test and merge |
The test failure is unrelated, merging. |
What's in this pull request?
Since
cmake
doesn't clear the cached values,We should remove
CMakeCache.txt
before re-configuration.(or explicitly unset cached values using
-U
)For example:
In
build-script-impl
, compare:In the latter case, we should explicitly specify
-USWIFT_MY_VALUE
inelse
branch to use the default value.But it's very annoying to apply that for every options.
More easy solution is to clear the cache by deleting
CMakeCache.txt
Before merging this pull request to apple/swift repository: