Unlike COMPILER_RT_HAS_CRT this handles the case where CRT is available
but has been disabled by setting COMPILER_RT_BUILD_CRT. This addresses
an issue reported on D153989.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
905 | HAS_CRT is the internal check and BUILD_CRT is user-configurable, right? Could we simplify this by ensuring that BUILD_CRT is always false is HAS_CRT is false (perhaps erroring out if the user explicitly asked it to be built when it's unavailable)? |
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
905 | That's what cmake_dependent_option on the line above was intended achieve. The problem is that there are some LLVM bots that use incremental builds and have COMPILER_RT_BUILD_CRT=ON in their CMake cache. I was hoping to force a clean build on these bots, but it looks like the Buildbot login is currently broken :( |
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
905 | Ah, that's subtle. If I'm reading https://cmake.org/cmake/help/latest/module/CMakeDependentOption.html correctly though, we'd overwrite the cache value in this file by creating a local variable. That wouldn't help test/builtins/CMakeLists.txt though. |
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
905 | A potential alternative would be to add unset(COMPILER_RT_BUILD_CRT CACHE) above cmake_dependent_option with TODO and then delete in in a follow up change. WDYT? |
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
905 | Yeah, I think that's cleaner and conveys the issue better. |
compiler-rt/lib/builtins/CMakeLists.txt | ||
---|---|---|
901 | This also appears to unset COMPILER_RT_BUILD_CRT when set on the command line. I was surprised to see the CRT builds being run for my builtins-only build config (I noticed because one of the tests was failing despite having REQUIRES: crt. I pass -DCOMPILER_RT_BUILD_CRT=OFF to cmake. Adding some prints around this statement shows the following: -- before unset(): COMPILER_RT_BUILD_CRT=OFF -- after unset: COMPILER_RT_BUILD_CRT= -- after cmake_dependent_option COMPILER_RT_BUILD_CRT=ON |
This also appears to unset COMPILER_RT_BUILD_CRT when set on the command line. I was surprised to see the CRT builds being run for my builtins-only build config (I noticed because one of the tests was failing despite having REQUIRES: crt.
I pass -DCOMPILER_RT_BUILD_CRT=OFF to cmake. Adding some prints around this statement shows the following: