forked from OSchip/llvm-project
[flang] Add CMake rules to install static and shared libraries in
the default install directory or in the directory specified with CMAKE_INSTALL_PREFIX. Fixes flang-compiler/f18#359. Original-commit: flang-compiler/f18@35ce1628e2 Reviewed-on: https://github.com/flang-compiler/f18/pull/364
This commit is contained in:
parent
7f87c2f754
commit
1de9ecd251
|
@ -37,8 +37,7 @@ endif()
|
|||
set(CMAKE_SKIP_BUILD_RPATH false)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH false)
|
||||
|
||||
# Don't use the installation RPATH when building
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" "${CMAKE_INSTALL_RPATH}")
|
||||
|
||||
# Reminder: Setting CMAKE_CXX_COMPILER must be done before calling project()
|
||||
|
||||
|
@ -100,7 +99,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
|||
# due to the need to preserve the right to override external entry points
|
||||
# at dynamic link time. -fno-semantic-interposition waives that right and
|
||||
# recovers a little bit of that performance.
|
||||
if (BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-semantic-interposition")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -28,3 +28,9 @@ add_library(FortranFIR
|
|||
target_link_libraries(FortranFIR
|
||||
FortranCommon
|
||||
)
|
||||
|
||||
install (TARGETS FortranFIR
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
|
|
@ -16,3 +16,9 @@ add_library(FortranCommon
|
|||
default-kinds.cc
|
||||
idioms.cc
|
||||
)
|
||||
|
||||
install (TARGETS FortranCommon
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
|
|
@ -39,6 +39,12 @@ target_link_libraries(FortranEvaluate
|
|||
m
|
||||
)
|
||||
|
||||
install (TARGETS FortranEvaluate
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
if (LIBPGMATH_DIR)
|
||||
# If pgmath library is found, it can be used for constant folding.
|
||||
find_library(LIBPGMATH pgmath PATHS ${LIBPGMATH_DIR})
|
||||
|
|
|
@ -33,3 +33,9 @@ add_library(FortranParser
|
|||
target_link_libraries(FortranParser
|
||||
FortranCommon
|
||||
)
|
||||
|
||||
install (TARGETS FortranParser
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
|
|
@ -39,3 +39,9 @@ target_link_libraries(FortranSemantics
|
|||
FortranCommon
|
||||
FortranEvaluate
|
||||
)
|
||||
|
||||
install (TARGETS FortranSemantics
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
|
|
@ -38,3 +38,5 @@ add_executable(f18-parse-demo
|
|||
target_link_libraries(f18-parse-demo
|
||||
FortranParser
|
||||
)
|
||||
|
||||
install(TARGETS f18 f18-parse-demo DESTINATION bin)
|
||||
|
|
Loading…
Reference in New Issue