summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2017-07-31 17:39:07 +0000
committerHans Wennborg <hans@hanshq.net>2017-07-31 17:39:07 +0000
commite44c13d6734d94530ad4977f6a2e486fe1fc1a26 (patch)
tree36c7fedd92a7d1483526fc694a8b3f34799c74c0 /cmake
parent9399b8424d2175af02eda9ba381613532ff8034d (diff)
Merging r309483:
------------------------------------------------------------------------ r309483 | mgorny | 2017-07-29 01:10:24 -0700 (Sat, 29 Jul 2017) | 7 lines [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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@309591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddOCaml.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
index 1b805c0710a3..daed7bb82b1b 100644
--- a/cmake/modules/AddOCaml.cmake
+++ b/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")