[PATCH] D86134: Fix OCaml build failure because of absolute path in system libs
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 10:38:48 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e4acb82f71a: [CMake] Fix OCaml build failure because of absolute path in system libs (authored by phosek).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86134/new/
https://reviews.llvm.org/D86134
Files:
llvm/lib/Support/CMakeLists.txt
Index: llvm/lib/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -2,6 +2,15 @@
set(imported_libs ZLIB::ZLIB)
endif()
+function(get_system_libname libpath libname)
+ get_filename_component(libpath ${libpath} NAME)
+ string(REPLACE ";" "|" PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ string(REPLACE ";" "|" SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
+ STRING(REGEX REPLACE "^(${PREFIXES})" "" libpath ${libpath})
+ STRING(REGEX REPLACE "(${SUFFIXES})$" "" libpath ${libpath})
+ set(${libname} "${libpath}" PARENT_SCOPE)
+endfunction()
+
if( MSVC OR MINGW )
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
# advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
@@ -22,7 +31,7 @@
set(system_libs ${system_libs} ${Backtrace_LIBFILE})
endif()
if( LLVM_ENABLE_TERMINFO )
- set(system_libs ${system_libs} ${TERMINFO_LIB})
+ set(imported_libs ${imported_libs} "${TERMINFO_LIB}")
endif()
if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) )
set(system_libs ${system_libs} atomic)
@@ -206,20 +215,15 @@
if(NOT zlib_library)
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
endif()
- get_filename_component(zlib_library ${zlib_library} NAME)
- if(CMAKE_STATIC_LIBRARY_PREFIX AND CMAKE_STATIC_LIBRARY_SUFFIX AND
- zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
- STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
- STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
- endif()
- if(CMAKE_SHARED_LIBRARY_PREFIX AND CMAKE_SHARED_LIBRARY_SUFFIX AND
- zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
- STRING(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
- STRING(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
- endif()
+ get_system_libname(${zlib_library} zlib_library)
set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
endif()
+if(LLVM_ENABLE_TERMINFO)
+ get_system_libname(${TERMINFO_LIB} terminfo_library)
+ set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}")
+endif()
+
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}")
if(LLVM_WITH_Z3)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86134.286609.patch
Type: text/x-patch
Size: 2508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200819/42323549/attachment.bin>
More information about the llvm-commits
mailing list