Skip to content
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

[clang] [cmake] Add cmake module dir before using GetDarwinLinkerVersion #86386

Merged
merged 1 commit into from Mar 23, 2024

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented Mar 23, 2024

Move the code adding top-level cmake/Modules directory to CMAKE_MODULE_PATH prior to including GetDarwinLinkerVersion, in order to fix standalone builds.

Fixes a regression introduced by 3bc71c2.

Move the code adding top-level cmake/Modules directory
to CMAKE_MODULE_PATH prior to including `GetDarwinLinkerVersion`,
in order to fix standalone builds.

Fixes a regression introduced by 3bc71c2.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Mar 23, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 23, 2024

@llvm/pr-subscribers-clang

Author: Michał Górny (mgorny)

Changes

Move the code adding top-level cmake/Modules directory to CMAKE_MODULE_PATH prior to including GetDarwinLinkerVersion, in order to fix standalone builds.

Fixes a regression introduced by 3bc71c2.


Full diff: https://github.com/llvm/llvm-project/pull/86386.diff

1 Files Affected:

  • (modified) clang/CMakeLists.txt (+7-7)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index ee783d52e4a4e2..284b2af24ddaa0 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -13,6 +13,13 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   set(CLANG_BUILT_STANDALONE TRUE)
 endif()
 
+# Make sure that our source directory is on the current cmake module path so that
+# we can include cmake files from this directory.
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
+  )
+
 # Must go below project(..)
 include(GNUInstallDirs)
 include(GetDarwinLinkerVersion)
@@ -141,13 +148,6 @@ if(CLANG_BUILT_STANDALONE)
   endif() # LLVM_INCLUDE_TESTS
 endif() # standalone
 
-# Make sure that our source directory is on the current cmake module path so that
-# we can include cmake files from this directory.
-list(INSERT CMAKE_MODULE_PATH 0
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
-  "${LLVM_COMMON_CMAKE_UTILS}/Modules"
-  )
-
 # This allows disabling clang's XML dependency even if LLVM finds libxml2.
 # By default, clang depends on libxml2 if LLVM does.
 option(CLANG_ENABLE_LIBXML2 "Whether libclang may depend on libxml2"

Copy link

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link

✅ With the latest revision this PR passed the Python code formatter.

mgorny referenced this pull request Mar 23, 2024
#86220)

The HOST_LINK_VERSION is a hardcoded string in Darwin clang that detects
the linker version at configure time. The driver uses this information
to build the correct set of arguments for the linker. This patch detects
the linker version again during compiler-rt configuration and passes it
to the tests. This allows a clang built on a machine with a new linker
to run compiler-rt tests on a machine with an old linker.

rdar://125198603
@usama54321
Copy link
Member

Thanks a lot for fixing this

@mgorny
Copy link
Member Author

mgorny commented Mar 23, 2024

Thanks!

@mgorny mgorny merged commit e14c6fa into llvm:main Mar 23, 2024
6 checks passed
@mgorny mgorny deleted the clang-make branch March 23, 2024 19:26
usama54321 pushed a commit to usama54321/apple-llvm-project that referenced this pull request Apr 4, 2024
…ion (llvm#86386)

Move the code adding top-level cmake/Modules directory to
CMAKE_MODULE_PATH prior to including `GetDarwinLinkerVersion`, in order
to fix standalone builds.

Fixes a regression introduced by
3bc71c2.
usama54321 pushed a commit to apple/llvm-project that referenced this pull request Apr 5, 2024
…ion (llvm#86386)

Move the code adding top-level cmake/Modules directory to
CMAKE_MODULE_PATH prior to including `GetDarwinLinkerVersion`, in order
to fix standalone builds.

Fixes a regression introduced by
3bc71c2.
usama54321 pushed a commit to usama54321/apple-llvm-project that referenced this pull request Apr 30, 2024
…ion (llvm#86386)

Move the code adding top-level cmake/Modules directory to
CMAKE_MODULE_PATH prior to including `GetDarwinLinkerVersion`, in order
to fix standalone builds.

Fixes a regression introduced by
3bc71c2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants