[LLVMdev] llvm in a subdirectory with cmake

Victor Zverovich
Wed, 10 Feb 2010 06:49:46 -0000

Hi All,

The proposed patch makes possible to use LLVM's CMake build infrastructure
(most importantly add_llvm_library and add_llvm_executable macros) from the
project that has llvm in a subdirectory.

For example:

demo/
    llvm/
    demo.cpp
    CMakeLists.txt

where CMakeLists.txt is as follows:

# ----------------------------- Start
of CMakeLists.txt ----------------------------------------

project(DEMO)
cmake_minimum_required(VERSION 2.6.1)

add_subdirectory("${DEMO_SOURCE_DIR}/llvm")

include_directories(
  "${LLVM_SOURCE_DIR}/include"
  "${LLVM_BINARY_DIR}/include"
)
set(LLVM_LINK_COMPONENTS core jit interpreter native)

add_llvm_executable(DEMO demo.cpp)

# ----------------------------- End
of CMakeLists.txt ----------------------------------------

As you can see with this patch creating a project using CMake outside of the
LLVM directory structure is as simple as inside.

To this end I made the following CMake variables stored in cache:

LLVM_COMMON_DEPENDS
LLVM_NATIVE_ARCH
llvm_libs
MSVC_LIB_DEPS_LLVM*

Best regards,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20100210/d427976c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Save-several-cmake-variables-to-cache-to-support-llv.patch
Type: application/octet-stream
Size: 20746 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20100210/d427976c/attachment.obj>