Skip to content

[flang] Support discovering LLVM/Clang/MLIR without explicit *_DIR #122639

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

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Jan 12, 2025

Support discovering LLVM, Clang and MLIR via the standard CMake logic in addition to explicitly specified LLVM_DIR, etc. To prevent breaking anyone's workflow the way #120914 did, this change explicitly introduces two possible code paths based on variables provided:

  1. If LLVM_DIR, etc. are defined, the current logic is used as-is.

  2. If they are not defined, find_package() is called normally to discover the packages using the standard CMake logic, and the discovered paths are added

Support discovering LLVM, Clang and MLIR via the standard CMake logic
in addition to explicitly specified `LLVM_DIR`, etc.  To prevent
breaking anyone's workflow the way llvm#120914 did, this change explicitly
introduces two possible code paths based on variables provided:

1. If `LLVM_DIR`, etc. are defined, the current logic is used as-is.

2. If they are not defined, `find_package()` is called normally to
   discover the packages using the standard CMake logic,
   and the discovered paths are added
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Jan 12, 2025
Copy link
Contributor

@luporl luporl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for preserving the old behavior.

I've tested these changes locally and standalone flang builds work.

@mgorny
Copy link
Member Author

mgorny commented Jan 13, 2025

Thanks!

@mgorny mgorny merged commit 305b25c into llvm:main Jan 13, 2025
5 of 6 checks passed
@mgorny mgorny deleted the flang-standalone-v2 branch January 13, 2025 17:18
kazutakahirata pushed a commit to kazutakahirata/llvm-project that referenced this pull request Jan 13, 2025
…lvm#122639)

Support discovering LLVM, Clang and MLIR via the standard CMake logic in
addition to explicitly specified `LLVM_DIR`, etc. To prevent breaking
anyone's workflow the way llvm#120914 did, this change explicitly introduces
two possible code paths based on variables provided:

1. If `LLVM_DIR`, etc. are defined, the current logic is used as-is.

2. If they are not defined, `find_package()` is called normally to
discover the packages using the standard CMake logic, and the discovered
paths are added

---------

Co-authored-by: Slava Zakharin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants