[llvm] [CMake] Add INTERFACE_INCLUDE_DIRECTORIES property to add_llvm_library macro (PR #90991)
Daniel Bashir via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 11:23:04 PDT 2024
https://github.com/db7894 created https://github.com/llvm/llvm-project/pull/90991
As mentioned in issue #53568, the current directions for using LLVM libraries in other projects, requiring
```
include_directories(${LLVM_INCLUDE_DIRS})
```
shouldn't be necessary. This adds `INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"` to the `add_llvm_library` macro in `AddLLVM.cmake`.
We may also want to add this to `add_clang_library` and other places, but I'm not familiar with the full details of LLVM's cmake setup either, so I'd appreciate feedback on this as a draft.
>From c7b5dc156d3bff582f2ed7ec7e6b49e6c4f62e13 Mon Sep 17 00:00:00 2001
From: Daniel Bashir <bashirdn at amazon.com>
Date: Fri, 3 May 2024 10:57:49 -0700
Subject: [PATCH] [CMake] Add INTERFACE_INCLUDE_DIRECTORIES property to
add_llvm_library macro
As mentioned in issue #53568, the current directions for using LLVM libraries in other projects, requiring
```
include_directories(${LLVM_INCLUDE_DIRS})
```
shouldn't be necessary. This adds `INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"` to the `add_llvm_library` macro in `AddLLVM.cmake`.
We may also want to add this to `add_clang_library` and other places, but I'm not familiar with the full details of LLVM's cmake setup either, so I'd appreciate feedback on this as a draft.
---
llvm/cmake/modules/AddLLVM.cmake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 693fd5669f63f9..3031bb268ce389 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -911,7 +911,8 @@ macro(add_llvm_library name)
${export_to_llvmexports}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
More information about the llvm-commits
mailing list