This is an archive of the discontinued LLVM Phabricator instance.

[flang][cmake] Improve how CLANG_DIR is handled
ClosedPublic

Authored by awarzynski on Mar 22 2021, 10:05 AM.

Details

Summary
  • Added a sanity check with Clang_FOUND to verify that find_package succeeded
  • Made sure that find_package won't use any of CMake's standard paths to guarantee that only the path provided with CLANG_DIR is considered (implemented through NO_DEFAULT_PATH)
  • Made the call to get_filename_component more explicit (so that it is clear what the base directory is)
  • Updated comments to clarify what CLANG_DIR means

Diff Detail

Event Timeline

awarzynski created this revision.Mar 22 2021, 10:05 AM
awarzynski requested review of this revision.Mar 22 2021, 10:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2021, 10:05 AM
rovka accepted this revision.Mar 23 2021, 4:58 AM

LGTM

This revision is now accepted and ready to land.Mar 23 2021, 4:58 AM

One quick question. Otherwise looks good.

flang/CMakeLists.txt
54

Why CLANG_DIR_ABSOLUTEDIR when the var above is declared as CLANG_DIR_ABSOLUTE? Am I missing something?

Make the semantics of CLANG_DIR more explicit

awarzynski retitled this revision from [flang][cmake] Make sure that CLANG_DIR is an absolute path to [flang][cmake] Improve how CLANG_DIR is handled.Mar 23 2021, 7:19 AM
awarzynski edited the summary of this revision. (Show Details)

One quick question. Otherwise looks good.

That was a typo, cheers for pointing out!

I've updated this patch a bit more. I think that the semantics of CLANG_DIR (and {LLVM|MLIR}_DIR) are a bit too convoluted. I hope that this will help clarifying. If this makes sense, I'll update MLIR_DIR and LLVM_DIR vars in a separate patch.

Looks good, thanks!

stevanradakovic accepted this revision.Mar 23 2021, 7:48 AM
This revision was landed with ongoing or failed builds.Mar 23 2021, 8:16 AM
This revision was automatically updated to reflect the committed changes.