[llvm] r309320 - [OCaml] Respect CMAKE_C_FLAGS for OCaml C files

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 14:13:19 PDT 2017


Author: mgorny
Date: Thu Jul 27 14:13:19 2017
New Revision: 309320

URL: http://llvm.org/viewvc/llvm-project?rev=309320&view=rev
Log:
[OCaml] Respect CMAKE_C_FLAGS for OCaml C files

Pass the values of CMAKE_C_FLAGS and CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}
as -ccopt to ocamlc. This enforces the specific flags used for the LLVM
build to be used for OCaml bindings as well, notably -O and -march
flags.

This also solves the issue of the user being unable to force specific
flags for OCaml bindings builds. Gentoo needs this to enforce -DNDEBUG
consistently between the LLVM build and the split OCaml bindings build.

Differential Revision: https://reviews.llvm.org/D35898

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=309320&r1=309319&r2=309320&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddOCaml.cmake (original)
+++ llvm/trunk/cmake/modules/AddOCaml.cmake Thu Jul 27 14:13:19 2017
@@ -83,7 +83,7 @@ function(add_ocaml_library name)
   endforeach()
 
   string(REPLACE ";" " " ARG_CFLAGS "${ARG_CFLAGS}")
-  set(c_flags "${ARG_CFLAGS} ${LLVM_DEFINITIONS}")
+  set(c_flags "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${ARG_CFLAGS} ${LLVM_DEFINITIONS}")
   foreach( include_dir ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR} )
     set(c_flags "${c_flags} -I${include_dir}")
   endforeach()




More information about the llvm-commits mailing list