Skip to content

Commit 3d2e05d

Browse files
rovkadpalermo
andcommitted
[flang] Install Fortran_main library
At the moment the Fortran_main library is not installed, so it cannot be found by the driver when run from an install directory. This patch fixes the issue by replacing llvm_add_library with add_flang_library, which already contains all the proper incantations for installing a library. It also enhances add_flang_library to support a STATIC arg which forces the library to be static even when BUILD_SHARED_LIBS is on. Differential Revision: https://reviews.llvm.org/D124759 Co-authored-by: Dan Palermo <[email protected]>
1 parent 05c3fe0 commit 3d2e05d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

flang/cmake/modules/AddFlang.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endmacro()
1818

1919
macro(add_flang_library name)
2020
cmake_parse_arguments(ARG
21-
"SHARED"
21+
"SHARED;STATIC"
2222
""
2323
"ADDITIONAL_HEADERS"
2424
${ARGN})
@@ -53,7 +53,7 @@ macro(add_flang_library name)
5353
else()
5454
# llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
5555
# so we need to handle it here.
56-
if (BUILD_SHARED_LIBS)
56+
if (BUILD_SHARED_LIBS AND NOT ARG_STATIC)
5757
set(LIBTYPE SHARED OBJECT)
5858
else()
5959
set(LIBTYPE STATIC OBJECT)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
llvm_add_library(Fortran_main STATIC
1+
add_flang_library(Fortran_main STATIC
22
Fortran_main.c
33
)

0 commit comments

Comments
 (0)