[llvm] r224962 - [go] Teach the go cmake build functions to funnel the include directories down into the cgo-setup variables of llvm-go.
Chandler Carruth
chandlerc at gmail.com
Mon Dec 29 14:50:31 PST 2014
Author: chandlerc
Date: Mon Dec 29 16:50:30 2014
New Revision: 224962
URL: http://llvm.org/viewvc/llvm-project?rev=224962&view=rev
Log:
[go] Teach the go cmake build functions to funnel the include directories down into the cgo-setup variables of llvm-go.
Summary:
This in turn allows us to use #includes with cgo that rely on CMake
provided include directories which is particularly useful for handling
generated headers that aren't reasonable to put in an "installable"
location.
Differential Revision: http://reviews.llvm.org/D6798
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=224962&r1=224961&r2=224962&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Dec 29 16:50:30 2014
@@ -628,9 +628,14 @@ function(llvm_add_go_executable binary p
set(binpath ${CMAKE_BINARY_DIR}/bin/${binary}${CMAKE_EXECUTABLE_SUFFIX})
set(cc "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}")
set(cxx "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
+ set(cppflags "")
+ get_property(include_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+ foreach(d ${include_dirs})
+ set(cppflags "${cppflags} -I${d}")
+ endforeach(d)
set(ldflags "${CMAKE_EXE_LINKER_FLAGS}")
add_custom_command(OUTPUT ${binpath}
- COMMAND ${CMAKE_BINARY_DIR}/bin/llvm-go "cc=${cc}" "cxx=${cxx}" "ldflags=${ldflags}"
+ COMMAND ${CMAKE_BINARY_DIR}/bin/llvm-go "cc=${cc}" "cxx=${cxx}" "cppflags=${cppflags}" "ldflags=${ldflags}"
${ARG_GOFLAGS} build -o ${binpath} ${pkgpath}
DEPENDS llvm-config ${CMAKE_BINARY_DIR}/bin/llvm-go${CMAKE_EXECUTABLE_SUFFIX}
${llvmlibs} ${ARG_DEPENDS}
More information about the llvm-commits
mailing list