Skip to content

Commit

Permalink
[flang] Install Fortran_main library
Browse files Browse the repository at this point in the history
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 <Dan.Palermo@amd.com>
  • Loading branch information
rovka and dpalermo committed May 16, 2022
1 parent 05c3fe0 commit 3d2e05d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flang/cmake/modules/AddFlang.cmake
Expand Up @@ -18,7 +18,7 @@ endmacro()

macro(add_flang_library name)
cmake_parse_arguments(ARG
"SHARED"
"SHARED;STATIC"
""
"ADDITIONAL_HEADERS"
${ARGN})
Expand Down Expand Up @@ -53,7 +53,7 @@ macro(add_flang_library name)
else()
# llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
# so we need to handle it here.
if (BUILD_SHARED_LIBS)
if (BUILD_SHARED_LIBS AND NOT ARG_STATIC)
set(LIBTYPE SHARED OBJECT)
else()
set(LIBTYPE STATIC OBJECT)
Expand Down
2 changes: 1 addition & 1 deletion flang/runtime/FortranMain/CMakeLists.txt
@@ -1,3 +1,3 @@
llvm_add_library(Fortran_main STATIC
add_flang_library(Fortran_main STATIC
Fortran_main.c
)

0 comments on commit 3d2e05d

Please sign in to comment.