[LLVMdev] llvm in a subdirectory with cmake
Óscar Fuentes
ofv at wanadoo.es
Wed Feb 10 04:48:06 PST 2010
Victor Zverovich <victor.zverovich at googlemail.com> writes:
> 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)
It is my intention to implement something similar to this on a cleaner
way. Using CACHE INTERNAL here and there is a recipe for maintenance
problems. My plan consists on configuring the client application with
-DLLVM=/path and then simply call functions for obtaining the list of
LLVM libraries for certain components, etc:
add_executable(foo foo.cpp)
llvm_libraries(MYVAR jit interpreter native)
add_target_dependencies(foo ${MYVAR})
More information about the llvm-dev
mailing list