[Lldb-commits] [lldb] a2c319f - [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project
Mark de Wever via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 16 09:30:40 PDT 2021
Author: Alfonso Gregory
Date: 2021-09-16T18:29:57+02:00
New Revision: a2c319fdc6b35ae6d8578459f07c89042775e5ec
URL: https://github.com/llvm/llvm-project/commit/a2c319fdc6b35ae6d8578459f07c89042775e5ec
DIFF: https://github.com/llvm/llvm-project/commit/a2c319fdc6b35ae6d8578459f07c89042775e5ec.diff
LOG: [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project
This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D107717
Added:
Modified:
clang/CMakeLists.txt
clang/lib/Basic/CMakeLists.txt
compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
compiler-rt/cmake/Modules/CompilerRTUtils.cmake
flang/CMakeLists.txt
libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
libunwind/CMakeLists.txt
lld/CMakeLists.txt
lld/Common/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
lldb/source/CMakeLists.txt
llvm/CMakeLists.txt
llvm/include/llvm/Support/CMakeLists.txt
runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 95cdbd8f6663a..29ceef8a4bd38 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -48,11 +48,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
- list(GET CONFIG_OUTPUT 6 LLVM_CONFIG_CMAKE_PATH)
+ list(GET CONFIG_OUTPUT 6 LLVM_CONFIG_CMAKE_DIR)
- # Normalize LLVM_CMAKE_PATH. --cmakedir might contain backslashes.
+ # Normalize LLVM_CMAKE_DIR. --cmakedir might contain backslashes.
# CMake assumes slashes as PATH.
- file(TO_CMAKE_PATH ${LLVM_CONFIG_CMAKE_PATH} LLVM_CMAKE_PATH)
+ file(TO_CMAKE_PATH ${LLVM_CONFIG_CMAKE_DIR} LLVM_CMAKE_DIR)
endif()
@@ -63,7 +63,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
endif()
- find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}")
+ find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR})
# We can't check LLVM_CONFIG here, because find_package(LLVM ...) also sets
@@ -75,11 +75,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set(LIBRARY_DIR ${LLVM_LIBRARY_DIR})
set(INCLUDE_DIR ${LLVM_INCLUDE_DIR})
set(LLVM_OBJ_DIR ${LLVM_BINARY_DIR})
- # The LLVM_CMAKE_PATH variable is set when doing non-standalone builds and
- # used in this project, so we need to make sure we set this value.
- # FIXME: LLVM_CMAKE_DIR comes from LLVMConfig.cmake. We should rename
- # LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project.
- set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR})
endif()
set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index c550e8cae03f3..d440f3b33dc9f 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -8,7 +8,7 @@ find_first_existing_vc_file("${CLANG_SOURCE_DIR}" clang_vc)
# The VC revision include that we want to generate.
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
if(llvm_vc AND LLVM_APPEND_VC_REV)
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
diff --git a/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake b/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
index 1080a4d0a795b..42ede171e41e5 100644
--- a/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTMockLLVMCMakeConfig.cmake
@@ -13,13 +13,13 @@ macro(compiler_rt_mock_llvm_cmake_config)
endmacro()
macro(compiler_rt_mock_llvm_cmake_config_set_cmake_path)
- # Point `LLVM_CMAKE_PATH` at the source tree in the monorepo.
- set(LLVM_CMAKE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
- if (NOT EXISTS "${LLVM_CMAKE_PATH}")
- message(FATAL_ERROR "LLVM_CMAKE_PATH (${LLVM_CMAKE_PATH}) does not exist")
+ # Point `LLVM_CMAKE_DIR` at the source tree in the monorepo.
+ set(LLVM_CMAKE_DIR "${LLVM_MAIN_SRC_DIR}/cmake/modules")
+ if (NOT EXISTS "${LLVM_CMAKE_DIR}")
+ message(FATAL_ERROR "LLVM_CMAKE_DIR (${LLVM_CMAKE_DIR}) does not exist")
endif()
- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
- message(STATUS "LLVM_CMAKE_PATH: \"${LLVM_CMAKE_PATH}\"")
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
+ message(STATUS "LLVM_CMAKE_DIR: \"${LLVM_CMAKE_DIR}\"")
endmacro()
function(compiler_rt_mock_llvm_cmake_config_set_target_triple)
@@ -71,5 +71,5 @@ endfunction()
macro(compiler_rt_mock_llvm_cmake_config_include_cmake_files)
# Some compiler-rt CMake code needs to call code in this file.
- include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
+ include("${LLVM_CMAKE_DIR}/AddLLVM.cmake")
endmacro()
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 63b4a65f47c0a..052095801aaed 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -289,7 +289,7 @@ macro(load_llvm_config)
"You are not using the monorepo layout. This configuration is DEPRECATED.")
endif()
- set(FOUND_LLVM_CMAKE_PATH FALSE)
+ set(FOUND_LLVM_CMAKE_DIR FALSE)
if (LLVM_CONFIG_PATH)
execute_process(
COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root" "--includedir"
@@ -372,21 +372,21 @@ macro(load_llvm_config)
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT)
if(NOT HAD_ERROR)
- string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
- file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG} LLVM_CMAKE_PATH)
+ string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_DIR_FROM_LLVM_CONFIG)
+ file(TO_CMAKE_PATH ${LLVM_CMAKE_DIR_FROM_LLVM_CONFIG} LLVM_CMAKE_DIR)
else()
file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+ set(LLVM_CMAKE_DIR "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
endif()
- set(LLVM_CMAKE_INCLUDE_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+ set(LLVM_CMAKE_INCLUDE_FILE "${LLVM_CMAKE_DIR}/LLVMConfig.cmake")
if (EXISTS "${LLVM_CMAKE_INCLUDE_FILE}")
- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
# Get some LLVM variables from LLVMConfig.
include("${LLVM_CMAKE_INCLUDE_FILE}")
- set(FOUND_LLVM_CMAKE_PATH TRUE)
+ set(FOUND_LLVM_CMAKE_DIR TRUE)
else()
- set(FOUND_LLVM_CMAKE_PATH FALSE)
+ set(FOUND_LLVM_CMAKE_DIR FALSE)
message(WARNING "LLVM CMake path (${LLVM_CMAKE_INCLUDE_FILE}) reported by llvm-config does not exist")
endif()
unset(LLVM_CMAKE_INCLUDE_FILE)
@@ -409,7 +409,7 @@ macro(load_llvm_config)
"This will be treated as error in the future.")
endif()
- if (NOT FOUND_LLVM_CMAKE_PATH)
+ if (NOT FOUND_LLVM_CMAKE_DIR)
# This configuration tries to configure without the prescence of `LLVMConfig.cmake`. It is
# intended for testing purposes (generating the lit test suites) and will likely not support
# a build of the runtimes in compiler-rt.
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 13ecc372a2ac3..f317340f9d355 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -35,7 +35,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()
# We need a pre-built/installed version of LLVM.
- find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}")
+ find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_DIR}")
# If the user specifies a relative path to LLVM_DIR, the calls to include
# LLVM modules fail. Append the absolute path to LLVM_DIR instead.
get_filename_component(LLVM_DIR_ABSOLUTE ${LLVM_DIR} REALPATH)
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index deaa2c3805f27..588d48efd412b 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -13,16 +13,16 @@ endif()
set(LLVM_INCLUDE_DIR ${LLVM_PATH}/include CACHE PATH "Path to llvm/include")
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
-set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
+set(LLVM_CMAKE_DIR "${LLVM_PATH}/cmake/modules")
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_CURRENT_BINARY_DIR}/lib")
-if (EXISTS "${LLVM_CMAKE_PATH}")
- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+if (EXISTS "${LLVM_CMAKE_DIR}")
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
else()
- message(FATAL_ERROR "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found. "
+ message(FATAL_ERROR "Neither ${LLVM_CMAKE_DIR} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found. "
"This is not a supported configuration.")
endif()
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index db202a72e640b..16331d948b124 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -364,6 +364,6 @@ if (LIBUNWIND_INCLUDE_DOCS)
add_subdirectory(docs)
endif()
-if (LIBUNWIND_INCLUDE_TESTS AND EXISTS ${LLVM_CMAKE_PATH})
+if (LIBUNWIND_INCLUDE_TESTS AND EXISTS ${LLVM_CMAKE_DIR})
add_subdirectory(test)
endif()
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 2e99564f4e3e9..f9b245f0d8dc5 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -27,7 +27,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT)
list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR)
- list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH)
+ list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_DIR)
list(GET LLVM_CONFIG_OUTPUT 3 MAIN_SRC_DIR)
set(LLVM_OBJ_ROOT ${OBJ_ROOT} CACHE PATH "path to LLVM build tree")
@@ -35,14 +35,14 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
file(TO_CMAKE_PATH ${LLVM_OBJ_ROOT} LLVM_BINARY_DIR)
- file(TO_CMAKE_PATH ${LLVM_CMAKE_PATH} LLVM_CMAKE_PATH)
+ file(TO_CMAKE_PATH ${LLVM_CMAKE_DIR} LLVM_CMAKE_DIR)
- if(NOT EXISTS "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+ if(NOT EXISTS "${LLVM_CMAKE_DIR}/LLVMConfig.cmake")
message(FATAL_ERROR "LLVMConfig.cmake not found")
endif()
- include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+ include("${LLVM_CMAKE_DIR}/LLVMConfig.cmake")
- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
include_directories("${LLVM_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS})
diff --git a/lld/Common/CMakeLists.txt b/lld/Common/CMakeLists.txt
index 0437d5afb8eb3..9fdc67be79012 100644
--- a/lld/Common/CMakeLists.txt
+++ b/lld/Common/CMakeLists.txt
@@ -8,7 +8,7 @@ find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
find_first_existing_vc_file("${LLD_SOURCE_DIR}" lld_vc)
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
if(lld_vc AND LLVM_APPEND_VC_REV)
set(lld_source_dir ${LLD_SOURCE_DIR})
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake
index 98d7848ce99b0..26812f9c63f7c 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -3,8 +3,8 @@ option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install
find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} NO_CMAKE_FIND_ROOT_PATH)
find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH)
-# We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc
-set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
+# We set LLVM_CMAKE_DIR so that GetSVN.cmake is found correctly when building SVNVersion.inc
+set(LLVM_CMAKE_DIR ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index 56ea8342be4e8..6cc89a9fcbaf0 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -8,7 +8,7 @@ set(lldbBase_SOURCES
find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
if(lldb_vc AND LLVM_APPEND_VC_REV)
set(lldb_source_dir ${LLDB_SOURCE_DIR})
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 8817fd32cef71..c48f50639d838 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -295,8 +295,8 @@ set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix
-# Note: LLVM_CMAKE_PATH does not include generated files
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+# Note: LLVM_CMAKE_DIR does not include generated files
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
set(LLVM_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
diff --git a/llvm/include/llvm/Support/CMakeLists.txt b/llvm/include/llvm/Support/CMakeLists.txt
index aeb5866ecbdde..b6be96525c744 100644
--- a/llvm/include/llvm/Support/CMakeLists.txt
+++ b/llvm/include/llvm/Support/CMakeLists.txt
@@ -3,7 +3,7 @@ find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
# The VC revision include that we want to generate.
set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSRevision.h")
-set(generate_vcs_version_script "${LLVM_CMAKE_PATH}/GenerateVersionFromVCS.cmake")
+set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
if(LLVM_APPEND_VC_REV)
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index ee73e5bbec574..2bde09b71699d 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -76,7 +76,7 @@ set(LLVM_RUNTIME_OUTPUT_INTDIR ${LLVM_TOOLS_BINARY_DIR})
# This variable makes sure that e.g. llvm-lit is found.
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
-set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules)
+set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
# This variable is used by individual runtimes to locate LLVM files.
set(LLVM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
More information about the lldb-commits
mailing list