Skip to content

RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig #97197

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions clang/cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include(GNUInstallPackageDir)
include(ExtendPath)
include(LLVMDistributionSupport)
include(FindPrefixFromConfig)
include(GetClangResourceDir)

# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
Expand Down Expand Up @@ -29,6 +30,10 @@ set(CLANG_CONFIG_INCLUDE_DIRS
"${CLANG_SOURCE_DIR}/include"
"${CLANG_BINARY_DIR}/include"
)

get_clang_resource_dir(resource_builddir PREFIX ${CLANG_BINARY_DIR})
set(CLANG_CONFIG_RESOURCE_DIR ${resource_builddir})

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
${clang_cmake_builddir}/ClangConfig.cmake
Expand Down Expand Up @@ -60,6 +65,10 @@ extend_path(base_includedir "\${CLANG_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDED
set(CLANG_CONFIG_INCLUDE_DIRS
"${base_includedir}"
)

get_clang_resource_dir(resource_installdir PREFIX ${CLANG_INSTALL_PREFIX})
set(CLANG_CONFIG_RESOURCE_DIR "${resource_installdir}")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake
Expand Down
1 change: 1 addition & 0 deletions clang/cmake/modules/ClangConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@")
set(CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@")
set(CLANG_INCLUDE_DIRS "@CLANG_CONFIG_INCLUDE_DIRS@")
set(CLANG_LINK_CLANG_DYLIB "@CLANG_LINK_CLANG_DYLIB@")
set(CLANG_RESOURCE_DIR "@CLANG_CONFIG_RESOURCE_DIR@")

# Provide all our library targets to users.
@CLANG_CONFIG_INCLUDE_EXPORTS@
Expand Down
Loading