Index: flang/cmake/modules/AddFlang.cmake =================================================================== --- flang/cmake/modules/AddFlang.cmake +++ flang/cmake/modules/AddFlang.cmake @@ -16,6 +16,27 @@ add_llvm_subdirectory(FLANG TOOL ${name}) endmacro() +macro(install_flang_library name) + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libflang") + get_target_export_arg(${name} Flang export_to_flangtargets UMBRELLA flang-libraries) + install(TARGETS ${name} + COMPONENT ${name} + ${export_to_flangtargets} + LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + + if (NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) + endif() + + set_property(GLOBAL APPEND PROPERTY FLANG_LIBS ${name}) + endif() + set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name}) +endmacro() + macro(add_flang_library name) cmake_parse_arguments(ARG "SHARED" @@ -64,25 +85,7 @@ llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs}) if (TARGET ${name}) - - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libflang") - get_target_export_arg(${name} Flang export_to_flangtargets UMBRELLA flang-libraries) - install(TARGETS ${name} - COMPONENT ${name} - ${export_to_flangtargets} - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - - if (NOT LLVM_ENABLE_IDE) - add_llvm_install_targets(install-${name} - DEPENDS ${name} - COMPONENT ${name}) - endif() - - set_property(GLOBAL APPEND PROPERTY FLANG_LIBS ${name}) - endif() - set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name}) + install_flang_library(${name}) else() # Add empty "phony" target add_custom_target(${name}) Index: flang/runtime/FortranMain/CMakeLists.txt =================================================================== --- flang/runtime/FortranMain/CMakeLists.txt +++ flang/runtime/FortranMain/CMakeLists.txt @@ -1,3 +1,5 @@ llvm_add_library(Fortran_main STATIC Fortran_main.c ) + +install_flang_library(Fortran_main)