This is an archive of the discontinued LLVM Phabricator instance.

[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS
ClosedPublic

Authored by phosek on Mar 30 2022, 10:38 AM.

Diff Detail

Event Timeline

phosek created this revision.Mar 30 2022, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 10:38 AM
phosek requested review of this revision.Mar 30 2022, 10:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 10:38 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

One issue I've had in the past is that CMake "helpfully" deduplicates flags specified via target_compile_options (and I assume that'll happen for setting the COMPILE_OPTIONS property as well), which turns things like -isystem /foo -isystem /bar into -isystem /foo /bar and breaks things. Is that a risk here? See https://gitlab.kitware.com/cmake/cmake/-/issues/15826

One issue I've had in the past is that CMake "helpfully" deduplicates flags specified via target_compile_options (and I assume that'll happen for setting the COMPILE_OPTIONS property as well), which turns things like -isystem /foo -isystem /bar into -isystem /foo /bar and breaks things. Is that a risk here? See https://gitlab.kitware.com/cmake/cmake/-/issues/15826

I haven't encountered any issues in my testing. The problem with COMPILE_FLAGS and LINK_FLAGS is that these don't seem to expand generator expressions while COMPILE_OPTIONS and LINK_OPTIONS do. I have a follow up change that revamps the use libc++ headers from compiler-rt and relies on generator expressions so this is a prerequisite.

ldionne accepted this revision.Mar 31 2022, 5:43 AM
This revision is now accepted and ready to land.Mar 31 2022, 5:43 AM

One issue I've had in the past is that CMake "helpfully" deduplicates flags specified via target_compile_options (and I assume that'll happen for setting the COMPILE_OPTIONS property as well), which turns things like -isystem /foo -isystem /bar into -isystem /foo /bar and breaks things. Is that a risk here? See https://gitlab.kitware.com/cmake/cmake/-/issues/15826

I haven't encountered any issues in my testing. The problem with COMPILE_FLAGS and LINK_FLAGS is that these don't seem to expand generator expressions while COMPILE_OPTIONS and LINK_OPTIONS do. I have a follow up change that revamps the use libc++ headers from compiler-rt and relies on generator expressions so this is a prerequisite.

SGTM

This revision was automatically updated to reflect the committed changes.
phosek reopened this revision.Apr 26 2022, 11:28 PM
This revision is now accepted and ready to land.Apr 26 2022, 11:28 PM
phosek updated this revision to Diff 439639.Jun 23 2022, 11:56 PM
This revision was landed with ongoing or failed builds.Jun 23 2022, 11:56 PM
This revision was automatically updated to reflect the committed changes.
phosek reopened this revision.Jun 27 2022, 11:24 PM
This revision is now accepted and ready to land.Jun 27 2022, 11:24 PM
phosek closed this revision.Jul 6 2022, 4:48 PM