[llvm] r374556 - [llvm] [ocaml] Support linking against dylib
Michal Gorny via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 07:32:43 PDT 2019
Author: mgorny
Date: Fri Oct 11 07:32:43 2019
New Revision: 374556
URL: http://llvm.org/viewvc/llvm-project?rev=374556&view=rev
Log:
[llvm] [ocaml] Support linking against dylib
Support linking OCaml modules against LLVM dylib when requested,
rather than against static libs that might not be installed at all.
Differential Revision: https://reviews.llvm.org/D68452
Modified:
llvm/trunk/cmake/modules/AddOCaml.cmake
Modified: llvm/trunk/cmake/modules/AddOCaml.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddOCaml.cmake?rev=374556&r1=374555&r2=374556&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddOCaml.cmake (original)
+++ llvm/trunk/cmake/modules/AddOCaml.cmake Fri Oct 11 07:32:43 2019
@@ -66,21 +66,25 @@ function(add_ocaml_library name)
list(APPEND ocaml_flags "-custom")
endif()
- explicit_map_components_to_libraries(llvm_libs ${ARG_LLVM})
- foreach( llvm_lib ${llvm_libs} )
- list(APPEND ocaml_flags "-l${llvm_lib}" )
- endforeach()
+ if(LLVM_LINK_LLVM_DYLIB)
+ list(APPEND ocaml_flags "-lLLVM")
+ else()
+ explicit_map_components_to_libraries(llvm_libs ${ARG_LLVM})
+ foreach( llvm_lib ${llvm_libs} )
+ list(APPEND ocaml_flags "-l${llvm_lib}" )
+ endforeach()
- get_property(system_libs TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
- foreach(system_lib ${system_libs})
- if (system_lib MATCHES "^-")
- # If it's an option, pass it without changes.
- list(APPEND ocaml_flags "${system_lib}" )
- else()
- # Otherwise assume it's a library name we need to link with.
- list(APPEND ocaml_flags "-l${system_lib}" )
- endif()
- endforeach()
+ get_property(system_libs TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
+ foreach(system_lib ${system_libs})
+ if (system_lib MATCHES "^-")
+ # If it's an option, pass it without changes.
+ list(APPEND ocaml_flags "${system_lib}" )
+ else()
+ # Otherwise assume it's a library name we need to link with.
+ list(APPEND ocaml_flags "-l${system_lib}" )
+ endif()
+ endforeach()
+ endif()
string(REPLACE ";" " " ARG_CFLAGS "${ARG_CFLAGS}")
set(c_flags "${ARG_CFLAGS} ${LLVM_DEFINITIONS}")
More information about the llvm-commits
mailing list