Skip to content
Merged
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
22 changes: 6 additions & 16 deletions flang/cmake/modules/AddFlang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,13 @@ function(add_flang_library name)
set(LIBTYPE SHARED STATIC)
elseif(ARG_SHARED)
set(LIBTYPE SHARED)
elseif(ARG_STATIC)
# If BUILD_SHARED_LIBS and ARG_STATIC are both set, llvm_add_library prioritizes STATIC.
# This is required behavior for libFortranFloat128Math.
set(LIBTYPE STATIC)
else()
# llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
# so we need to handle it here.
if(BUILD_SHARED_LIBS)
set(LIBTYPE SHARED)
else()
set(LIBTYPE STATIC)
endif()
if(NOT XCODE AND NOT MSVC_IDE)
# The Xcode generator doesn't handle object libraries correctly.
# The Visual Studio CMake generator does handle object libraries
# correctly, but it is preferable to list the libraries with their
# source files (instead of the object files and the source files in
# a separate target in the "Object Libraries" folder)
list(APPEND LIBTYPE OBJECT)
endif()
set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
# Let llvm_add_library decide, taking BUILD_SHARED_LIBS into account.
set(LIBTYPE)
endif()
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})

Expand Down