[PATCH] D35898: [OCaml] Pass -D/-UNDEBUG through to ocamlc

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 29 00:23:28 PDT 2017


mgorny updated this revision to Diff 108778.
mgorny retitled this revision from "[OCaml] Respect CMAKE_C_COMPILER & CMAKE_C_FLAGS for OCaml C files" to "[OCaml] Pass -D/-UNDEBUG through to ocamlc".
mgorny edited the summary of this revision.
mgorny added a comment.

Updated to only play with NDEBUG definitions.


https://reviews.llvm.org/D35898

Files:
  cmake/modules/AddOCaml.cmake


Index: cmake/modules/AddOCaml.cmake
===================================================================
--- cmake/modules/AddOCaml.cmake
+++ cmake/modules/AddOCaml.cmake
@@ -87,6 +87,11 @@
   foreach( include_dir ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR} )
     set(c_flags "${c_flags} -I${include_dir}")
   endforeach()
+  # include -D/-UNDEBUG to match dump function visibility
+  # regex from HandleLLVMOptions.cmake
+  string(REGEX MATCH "(^| )[/-][UD] *NDEBUG($| )" flag_matches
+         "${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${CMAKE_C_FLAGS}")
+  set(c_flags "${c_flags} ${flag_matches}")
 
   foreach( ocaml_file ${ARG_OCAML} )
     list(APPEND sources "${ocaml_file}.mli" "${ocaml_file}.ml")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35898.108778.patch
Type: text/x-patch
Size: 714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170729/23ba61a2/attachment.bin>


More information about the llvm-commits mailing list