Skip to content

Commit

Permalink
Consistently set and use CLANG_CMAKE_DIR
Browse files Browse the repository at this point in the history
For standard CMake, Clang_DIR should include the lib/cmake/clang
subdirectory suffix. This currently works only because Clad defines
HINTS itself.
  • Loading branch information
hahnjo authored and jenkins committed Jan 23, 2025
1 parent 1d49255 commit 701ef1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )

find_package(Clang REQUIRED CONFIG)
message(STATUS "Found supported version: Clang ${CLANG_PACKAGE_VERSION}")
message(STATUS "Using ClangConfig.cmake in: ${Clang_DIR}")
message(STATUS "Using ClangConfig.cmake in: ${CLANG_CMAKE_DIR}")

find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
Expand Down Expand Up @@ -111,6 +111,7 @@ else()
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
include(${LLVMCONFIG_FILE})
endif()
set(CLANG_CMAKE_DIR "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang")
if (NOT CLANG_INCLUDE_DIRS)
set (CLANG_INCLUDE_DIRS "${LLVM_MAIN_SRC_DIR}/tools/clang/include")
if (NOT EXISTS ${CLANG_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export(TARGETS ${CLING_EXPORTS} FILE ${cling_cmake_builddir}/ClingTargets.cmake)

# Generate ClingConfig.cmake for the build tree.
set(CLING_CONFIG_CMAKE_DIR "${cling_cmake_builddir}")
set(CLING_CONFIG_CLANG_CMAKE_DIR "${clang_cmake_builddir}")
set(CLING_CONFIG_CLANG_CMAKE_DIR "${CLANG_CMAKE_DIR}")
set(CLING_CONFIG_EXPORTS_FILE "${cling_cmake_builddir}/ClingTargets.cmake")
set(CLING_CONFIG_INCLUDE_DIRS
"${CLING_SOURCE_DIR}/include"
Expand Down
6 changes: 1 addition & 5 deletions tools/plugins/clad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ if (CMAKE_CXX_STANDARD)
list(APPEND _clad_extra_cmake_args -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD})
endif(CMAKE_CXX_STANDARD)

if (Clang_DIR)
list(APPEND _clad_extra_cmake_args -DClang_DIR=${Clang_DIR} -DClang_CONFIG_EXTRA_PATH_HINTS=${Clang_Config_ExtraPathHints})
endif(Clang_DIR)

if (LLVM_FORCE_USE_OLD_TOOLCHAIN)
list(APPEND _clad_extra_cmake_args -DLLVM_FORCE_USE_OLD_TOOLCHAIN=${LLVM_FORCE_USE_OLD_TOOLCHAIN})
endif(LLVM_FORCE_USE_OLD_TOOLCHAIN)
Expand Down Expand Up @@ -94,7 +90,7 @@ ExternalProject_Add(
-DCMAKE_CXX_FLAGS=${CLAD_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=${clad_install_dir}/plugins
-DLLVM_DIR=${LLVM_BINARY_DIR}
-DCLANG_INCLUDE_DIRS=${CLANG_INCLUDE_DIRS}
-DClang_DIR=${CLANG_CMAKE_DIR}
${_clad_extra_cmake_args}
# FIXME
# Building with 1 core is a temporary workaround for #16654 and has to be
Expand Down

0 comments on commit 701ef1f

Please sign in to comment.