This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][CMake] Use correct output paths and passthrough necessary options
ClosedPublic

Authored by phosek on May 16 2023, 10:43 PM.

Diff Detail

Event Timeline

phosek created this revision.May 16 2023, 10:43 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
phosek requested review of this revision.May 16 2023, 10:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 10:43 PM
michaelplatings added inline comments.
bolt/CMakeLists.txt
88

The documentation for CMAKE_SYSROOT says "This variable may only be set in a toolchain file specified by the CMAKE_TOOLCHAIN_FILE variable."

Maybe pass CMAKE_TOOLCHAIN_FILE through instead?

88

list(APPEND variable_that_may_or_may_not_exist ... is quite fragile. Should someone have -Dextra_args=X on their cmake command line then that will be included here, which I don't think is the intent. I suggest adding set(extra_args "") above the if. This also improves readability because otherwise you have to scan the whole file to figure out that extra_args wasn't previously defined.

98–99

Given that the install step now does nothing, and the install statement below passes -DCMAKE_INSTALL_PREFIX explicitly, could this line be deleted? Alternatively perhaps -DCMAKE_INSTALL_PREFIX could be removed from the install statement.

103

These targets don't appear to be used. I suggest either deleting this line, or if they're needed/useful somehow then adding a comment either here or in the commit message.

phosek updated this revision to Diff 523691.May 19 2023, 1:42 AM
phosek marked 3 inline comments as done.
phosek added inline comments.
bolt/CMakeLists.txt
88
michaelplatings accepted this revision.May 19 2023, 2:04 AM

LGTM

bolt/CMakeLists.txt
88

Deviating from what's documented as permitted could cause a problem with future CMake versions. But evidently this pattern is already established in LLVM, and if it becomes a problem in future then it can be fixed at that time.

This revision is now accepted and ready to land.May 19 2023, 2:04 AM
Amir added a comment.May 19 2023, 10:12 AM

Please retitle as "[BOLT][CMake] ..."

phosek retitled this revision from [bolt] Use correct output paths and passthrough necessary options to [BOLT][CMake] Use correct output paths and passthrough necessary options.May 19 2023, 10:43 AM
phosek added inline comments.May 19 2023, 10:43 AM
bolt/CMakeLists.txt
88

I agree, ideally we would use the same helper function everywhere where we need to invoke CMake as a subbuild so the passthrough is handled uniformly, but that can be done as a future improvement.

This revision was landed with ongoing or failed builds.May 19 2023, 10:43 AM
This revision was automatically updated to reflect the committed changes.