[flang-commits] [flang] cbfa4aa - [flang] Refine how Clang dependencies are expressed #58663
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Sun Apr 16 10:45:45 PDT 2023
Author: Ezike Ebuka
Date: 2023-04-16T17:44:25Z
New Revision: cbfa4aa75ffd31f0068b0603e83cd8a7c3ee4260
URL: https://github.com/llvm/llvm-project/commit/cbfa4aa75ffd31f0068b0603e83cd8a7c3ee4260
DIFF: https://github.com/llvm/llvm-project/commit/cbfa4aa75ffd31f0068b0603e83cd8a7c3ee4260.diff
LOG: [flang] Refine how Clang dependencies are expressed #58663
Fixes #58663
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D140998
Added:
Modified:
flang/cmake/modules/AddFlang.cmake
flang/lib/Frontend/CMakeLists.txt
flang/lib/FrontendTool/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake
index 4332eb83c013e..41ce8738e7bf2 100644
--- a/flang/cmake/modules/AddFlang.cmake
+++ b/flang/cmake/modules/AddFlang.cmake
@@ -16,12 +16,15 @@ macro(add_flang_subdirectory name)
add_llvm_subdirectory(FLANG TOOL ${name})
endmacro()
-macro(add_flang_library name)
+function(add_flang_library name)
+ set(options SHARED STATIC INSTALL_WITH_TOOLCHAIN)
+ set(multiValueArgs ADDITIONAL_HEADERS CLANG_LIBS)
cmake_parse_arguments(ARG
- "SHARED;STATIC;INSTALL_WITH_TOOLCHAIN"
+ "${options}"
""
- "ADDITIONAL_HEADERS"
+ "${multiValueArgs}"
${ARGN})
+
set(srcs)
if (MSVC_IDE OR XCODE)
# Add public headers
@@ -63,6 +66,8 @@ macro(add_flang_library name)
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
+ clang_target_link_libraries(${name} PRIVATE ${ARG_CLANG_LIBS})
+
if (TARGET ${name})
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libflang"
@@ -91,7 +96,7 @@ macro(add_flang_library name)
set_target_properties(${name} PROPERTIES FOLDER "Flang libraries")
set_flang_windows_version_resource_properties(${name})
-endmacro(add_flang_library)
+endfunction(add_flang_library)
macro(add_flang_executable name)
add_llvm_executable(${name} ${ARGN})
diff --git a/flang/lib/Frontend/CMakeLists.txt b/flang/lib/Frontend/CMakeLists.txt
index c23a395107018..2dd86f9d7350f 100644
--- a/flang/lib/Frontend/CMakeLists.txt
+++ b/flang/lib/Frontend/CMakeLists.txt
@@ -51,16 +51,8 @@ add_flang_library(flangFrontend
TargetParser
FrontendOpenACC
FrontendOpenMP
-)
-
-if(CLANG_LINK_CLANG_DYLIB)
- add_dependencies(flangFrontend clang-cpp)
-else()
- add_dependencies(flangFrontend clangBasic)
-endif()
-clang_target_link_libraries(flangFrontend
- PRIVATE
+ CLANG_LIBS
clangBasic
clangDriver
)
diff --git a/flang/lib/FrontendTool/CMakeLists.txt b/flang/lib/FrontendTool/CMakeLists.txt
index 59e4bd5d35736..2acaffbe50380 100644
--- a/flang/lib/FrontendTool/CMakeLists.txt
+++ b/flang/lib/FrontendTool/CMakeLists.txt
@@ -13,16 +13,8 @@ add_flang_library(flangFrontendTool
LINK_COMPONENTS
Option
Support
-)
-
-if(CLANG_LINK_CLANG_DYLIB)
- add_dependencies(flangFrontend clang-cpp)
-else()
- add_dependencies(flangFrontendTool clangBasic)
-endif()
-clang_target_link_libraries(flangFrontendTool
- PRIVATE
+ CLANG_LIBS
clangBasic
clangDriver
)
More information about the flang-commits
mailing list