Timo Janssen via llvm-dev
2016-Oct-09 14:18 UTC
[llvm-dev] Embedding llvm as a git submodule in Project
Hi all. I want to use llvm in my project and I want to make llvm a git submodule in my project. http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project At this in the documentation it claims to describe how to embed llvm into a project. I tried it that way but it doesn't work, because there isn't any findLLVM.cmake in the llvm/cmake/modules directory anymore (i don't know if there was one in the past). Can someone tell me how to do it now. Timo Janssen
don hinton via llvm-dev
2016-Oct-09 16:53 UTC
[llvm-dev] Embedding llvm as a git submodule in Project
Hi Timo: Please take a look at cmake's find_package documentation for a full description on how it works, but in general, find_package(LLVM) will look for a file named LLVMConfig.cmake, not findLLVM.cmake. However, unless that file is in the well known search path used by find_package, you'll need to add the path to CMAKE_MODULE_PATH. hth... don On Sunday, October 9, 2016, Timo Janssen via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all. > > > I want to use llvm in my project and I want to make llvm a git submodule > in my project. > > http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project > > At this in the documentation it claims to describe how to embed llvm into > a project. I tried it that way but it doesn't work, because there isn't any > findLLVM.cmake in the llvm/cmake/modules directory anymore (i don't know if > there was one in the past). > > > Can someone tell me how to do it now. > > > Timo Janssen > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161009/77208dd4/attachment.html>
Timo Janssen via llvm-dev
2016-Oct-09 21:03 UTC
[llvm-dev] Embedding llvm as a git submodule in Project
Hi, I am sorry but I really am not good with cmake yet. I made one mistake I used MODULE instead of CONFIG in find_package. But even with CONFIG I doesn't work for me. Here my CMakeLists.txt: cmake_minimum_required(VERSION 3.5.1) project(SimpleProject) find_package(LLVM REQUIRED CONFIG PATHS "${CMAKE_CURRENT_SOURCE_DIR}/llvm/cmake$ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") include_directories(${LLVM_INCLUDE_DIRS}) add_definitions(${LLVM_DEFINITIONS}) add_executable(simple-tool main.cpp) llvm_map_components_to_libnames(llvm_libs support) target_link_libraries(simple-tool ${llvm_libs}) Here part of the cmake output in terminal: CMake Error at CMakeLists.txt:4 (find_package): Could not find a package configuration file provided by "LLVM" with any of the following names: LLVMConfig.cmake llvm-config.cmake Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set "LLVM_DIR" to a directory containing one of the above files. If "LLVM" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "/home/timoo/Schreibtisch/build/CMakeFiles/CMakeOutput.log" I added the PATHS to find_package becouse the command must find the files. In the llvm/cmake/modules dircotry are: LLVM-Config.cmake (instead of lower case) and LLVMConfig.cmake.in (.in added at end) So what must I do? Am 09.10.2016 um 16:18 schrieb Timo Janssen:> Hi all. > > > I want to use llvm in my project and I want to make llvm a git > submodule in my project. > > http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project > > At this in the documentation it claims to describe how to embed llvm > into a project. I tried it that way but it doesn't work, because there > isn't any findLLVM.cmake in the llvm/cmake/modules directory anymore > (i don't know if there was one in the past). > > > Can someone tell me how to do it now. > > > Timo Janssen >
don hinton via llvm-dev
2016-Oct-10 00:10 UTC
[llvm-dev] Embedding llvm as a git submodule in Project
Hi Timo: You need to find LLVMConfig.cmake in the binary or install directory tree, not the source tree. Although I don't embed clang/llvm, my config might help you figure it -- clang/llvm installed under (could have used build directory) ~/usr : $ cd /Users/dhinton/projects/cover/build/ && rm -rf * && CC=~/usr/bin/clang CXX=~/usr/bin/clang++ LLVM_DIR=~/usr/lib/cmake/llvm cmake ../CVRFI/ -GNinja $ cat ../CVRFI/CMakeLists.txt cmake_minimum_required(VERSION 2.8) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Make Debug the default, pass -DCMAKE_BUILD_TYPE=Release to change this. if (NOT CMAKE_BUILD_TYPE) message ("Setting CMAKE_BUILD_TYPE = Debug") set(CMAKE_BUILD_TYPE Debug) endif() if(APPLE) set(CMAKE_MACOSX_RPATH ON) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter") # While just setting LLVM_DIR will make find_package work, you need to # add it to CMAKE_MODULE_PATH if you want to include AddLLVM, e.g., if # you want to use add_llvm_loadable_module. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{LLVM_DIR}") find_package(LLVM REQUIRED CONFIG) include(AddLLVM) add_definitions(${LLVM_DEFINITIONS}) include_directories(${LLVM_INCLUDE_DIRS}) link_directories(${LLVM_LIBRARY_DIRS}) On Sun, Oct 9, 2016 at 2:03 PM, Timo Janssen via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > > I am sorry but I really am not good with cmake yet. > > I made one mistake I used MODULE instead of CONFIG in find_package. > > But even with CONFIG I doesn't work for me. > > > Here my CMakeLists.txt: > > > cmake_minimum_required(VERSION 3.5.1) > project(SimpleProject) > > find_package(LLVM REQUIRED CONFIG PATHS "${CMAKE_CURRENT_SOURCE_DIR}/l > lvm/cmake$ > > message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") > message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") > > include_directories(${LLVM_INCLUDE_DIRS}) > add_definitions(${LLVM_DEFINITIONS}) > > add_executable(simple-tool main.cpp) > > llvm_map_components_to_libnames(llvm_libs support) > > target_link_libraries(simple-tool ${llvm_libs}) > > > Here part of the cmake output in terminal: > > CMake Error at CMakeLists.txt:4 (find_package): > Could not find a package configuration file provided by "LLVM" with any > of > the following names: > > LLVMConfig.cmake > llvm-config.cmake > > Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set > "LLVM_DIR" to a directory containing one of the above files. If "LLVM" > provides a separate development package or SDK, be sure it has been > installed. > > > -- Configuring incomplete, errors occurred! > See also "/home/timoo/Schreibtisch/build/CMakeFiles/CMakeOutput.log" > > > I added the PATHS to find_package becouse the command must find the files. > > In the llvm/cmake/modules dircotry are: > > LLVM-Config.cmake (instead of lower case) and > > LLVMConfig.cmake.in (.in added at end) > > > So what must I do? > > > > Am 09.10.2016 um 16:18 schrieb Timo Janssen: > >> Hi all. >> >> >> I want to use llvm in my project and I want to make llvm a git submodule >> in my project. >> >> http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project >> >> At this in the documentation it claims to describe how to embed llvm into >> a project. I tried it that way but it doesn't work, because there isn't any >> findLLVM.cmake in the llvm/cmake/modules directory anymore (i don't know if >> there was one in the past). >> >> >> Can someone tell me how to do it now. >> >> >> Timo Janssen >> >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161009/4e86d36e/attachment.html>