summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/AddOCaml.cmake
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2017-07-29 08:10:24 +0000
committerMichal Gorny <mgorny@gentoo.org>2017-07-29 08:10:24 +0000
commit4ba0c1dc4a08d396004c3cda38efcd8ad4ae2661 (patch)
treea1f32f5e04c4ce11e9995c619c0618855c941608 /llvm/cmake/modules/AddOCaml.cmake
parent4194ebff8dcb6d7dc747b934bb7e491c40f4b899 (diff)
downloadbcm5719-llvm-4ba0c1dc4a08d396004c3cda38efcd8ad4ae2661.tar.gz
bcm5719-llvm-4ba0c1dc4a08d396004c3cda38efcd8ad4ae2661.zip
[OCaml] Pass -D/-UNDEBUG through to ocamlc
Detect [/-][DU]NDEBUG in CMAKE_C_FLAGS* and pass them through to ocamlc. This is necessary because their value might affect visibility of dump functions in LLVM and ocamlc uses its own compiler and flags by default. Differential Revision: https://reviews.llvm.org/D35898 llvm-svn: 309483
Diffstat (limited to 'llvm/cmake/modules/AddOCaml.cmake')
-rw-r--r--llvm/cmake/modules/AddOCaml.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/cmake/modules/AddOCaml.cmake b/llvm/cmake/modules/AddOCaml.cmake
index ef9c8ec6e60..1d8094cc505 100644
--- a/llvm/cmake/modules/AddOCaml.cmake
+++ b/llvm/cmake/modules/AddOCaml.cmake
@@ -87,6 +87,11 @@ function(add_ocaml_library name)
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")
OpenPOWER on IntegriCloud