[clang] [clang] [cmake] Add cmake module dir before using GetDarwinLinkerVersion (PR #86386)
Michał Górny via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 23 02:37:17 PDT 2024
https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/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 3bc71c2abfa00413fd15cf0e5c08af6ec0d4768b.
>From 1639e99721c2aeee584437d8987f0633010c401f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Sat, 23 Mar 2024 10:33:38 +0100
Subject: [PATCH] [clang] [cmake] Add cmake module dir before using
GetDarwinLinkerVersion
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 3bc71c2abfa00413fd15cf0e5c08af6ec0d4768b.
---
clang/CMakeLists.txt | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
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"
More information about the cfe-commits
mailing list