[PATCH] [OCaml] fix tests in the CMake static library codepath

Ramkumar Ramachandra artagnon at gmail.com
Mon Dec 29 16:46:53 PST 2014


Hi whitequark, rafael,

OCaml bindings built statically with CMake are good for nothing, as
shown by the test failures. Make two changes to make tests pass:

1. Fix AddOCaml CMake rule to link in the case of static lib.
2. Add the LIBDIR variable required by lit.cfg.

Signed-off-by: Ramkumar Ramachandra <artagnon at gmail.com>

http://reviews.llvm.org/D6806

Files:
  CMakeLists.txt
  cmake/modules/AddOCaml.cmake

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -147,6 +147,7 @@
 # Each of them corresponds to llvm-config's.
 set(LLVM_TOOLS_BINARY_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) # --bindir
 set(LLVM_LIBRARY_DIR      ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir
+set(LIBDIR                ${LLVM_LIBRARY_OUTPUT_INTDIR}) # alias for lit
 set(LLVM_MAIN_SRC_DIR     ${CMAKE_CURRENT_SOURCE_DIR}  ) # --src-root
 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
 set(LLVM_BINARY_DIR       ${CMAKE_CURRENT_BINARY_DIR}  ) # --prefix
Index: cmake/modules/AddOCaml.cmake
===================================================================
--- cmake/modules/AddOCaml.cmake
+++ cmake/modules/AddOCaml.cmake
@@ -52,7 +52,7 @@
          "${bin}/${name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
   endif()
 
-  set(ocaml_flags "-lstdc++" "-ldopt" "-L${LLVM_LIBRARY_OUTPUT_INTDIR}"
+  set(ocaml_flags "-lstdc++" "-L${LLVM_LIBRARY_DIR}"
                   ${ocaml_pkgs})
 
   foreach( ocaml_dep ${ARG_OCAMLDEP} )
@@ -144,7 +144,7 @@
     OUTPUT "${bin}/${name}.odoc"
     COMMAND "${OCAMLFIND}" "ocamldoc"
             "-I" "${bin}"
-            "-I" "${LLVM_LIBRARY_OUTPUT_INTDIR}/ocaml/"
+            "-I" "${LLVM_LIBRARY_DIR}/ocaml/"
             "-dump" "${bin}/${name}.odoc"
             ${ocaml_pkgs} ${ocaml_inputs}
     DEPENDS ${ocaml_inputs}
@@ -192,7 +192,7 @@
     get_filename_component(filename "${install_file}" NAME)
     add_custom_command(TARGET "ocaml_${name}" POST_BUILD
       COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${install_file}"
-                                             "${LLVM_LIBRARY_OUTPUT_INTDIR}/ocaml/"
+                                             "${LLVM_LIBRARY_DIR}/ocaml/"
       COMMENT "Copying OCaml library component ${filename} to intermediate area"
       VERBATIM)
   endforeach()

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6806.17700.patch
Type: text/x-patch
Size: 1898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141230/ba1aa901/attachment.bin>


More information about the llvm-commits mailing list