<div dir="ltr">Sorry my example wasn't helpful.<div><br></div><div>I did take a quick look at rust -- though I didn't download or try to build it -- and they seem to allow you to use an installed or prebuilt version in addition to building it in-tree.  However, even when they build it in-tree, they build the whole thing -- see mk/<a href="http://llvm.mk">llvm.mk</a>.</div><div><br></div><div>Good luck...</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 10, 2016 at 1:33 AM, Timo Janssen via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hi Don,</p>
    <p><br>
    </p>
    <p>thanks, but that isn't completely what I want.</p>
    <p>THe way you explain it, I have to first build llvm an install and
      then seperately my project. <br>
    </p>
    <p>But that isn't what I want. I want to build it together as one
      thing. In the Rust Compiler they have llvm as a submodule in src
      folder. I don't know how they do it but they don't use CMake so it
      won't really help to look it up. And I want to only build those
      llvm libraries I will need for my project. <br>
    </p><div><div class="h5">
    <br>
    <div class="m_8421636481832724823moz-cite-prefix">Am 10.10.2016 um 02:10 schrieb don
      hinton:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Timo:
        <div><br>
        </div>
        <div>You need to find LLVMConfig.cmake in the binary or install
          directory tree, not the source tree.  </div>
        <div><br>
        </div>
        <div>Although I don't embed clang/llvm, my config might help you
          figure it -- clang/llvm installed under (could have used build
          directory) ~/usr :</div>
        <div><br>
        </div>
        <div>$ cd /Users/dhinton/projects/cover/<wbr>build/ && rm -rf
          * && CC=~/usr/bin/clang CXX=~/usr/bin/clang++
          LLVM_DIR=~/usr/lib/cmake/llvm cmake ../CVRFI/ -GNinja<br>
        </div>
        <div><br>
        </div>
        <div>$ cat ../CVRFI/CMakeLists.txt</div>
        <div>
          <div>cmake_minimum_required(VERSION 2.8)</div>
          <div><br>
          </div>
          <div>set(CMAKE_EXPORT_COMPILE_<wbr>COMMANDS ON)</div>
          <div><br>
          </div>
          <div>set(CMAKE_RUNTIME_OUTPUT_<wbr>DIRECTORY
            ${CMAKE_BINARY_DIR}/bin)</div>
          <div>set(CMAKE_LIBRARY_OUTPUT_<wbr>DIRECTORY
            ${CMAKE_BINARY_DIR}/lib)</div>
          <div>set(CMAKE_ARCHIVE_OUTPUT_<wbr>DIRECTORY
            ${CMAKE_BINARY_DIR}/lib)</div>
          <div><br>
          </div>
          <div># Make Debug the default, pass -DCMAKE_BUILD_TYPE=Release
            to change this.</div>
          <div>if (NOT CMAKE_BUILD_TYPE)</div>
          <div>        message ("Setting CMAKE_BUILD_TYPE = Debug")</div>
          <div>        set(CMAKE_BUILD_TYPE Debug)</div>
          <div>endif()</div>
          <div><br>
          </div>
          <div>if(APPLE)</div>
          <div>  set(CMAKE_MACOSX_RPATH ON)</div>
          <div>  set(CMAKE_MODULE_LINKER_FLAGS
            "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")</div>
          <div>  set(CMAKE_SHARED_LINKER_FLAGS
            "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")</div>
          <div>endif()</div>
          <div><br>
          </div>
          <div>set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")</div>
          <div><br>
          </div>
          <div>set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra
            -Wno-unused-parameter")</div>
          <div><br>
          </div>
          <div># While just setting LLVM_DIR will make find_package
            work, you need to</div>
          <div># add it to CMAKE_MODULE_PATH if you want to include
            AddLLVM, e.g., if</div>
          <div># you want to use add_llvm_loadable_module.</div>
          <div>set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
            "$ENV{LLVM_DIR}")</div>
          <div>find_package(LLVM REQUIRED CONFIG)</div>
          <div>include(AddLLVM)</div>
          <div>add_definitions(${LLVM_<wbr>DEFINITIONS})</div>
          <div>include_directories(${LLVM_<wbr>INCLUDE_DIRS})</div>
          <div>link_directories(${LLVM_<wbr>LIBRARY_DIRS})</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sun, Oct 9, 2016 at 2:03 PM, Timo
          Janssen via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
            <br>
            <br>
            I am sorry but I really am not good with cmake yet.<br>
            <br>
            I made one mistake I used MODULE instead of CONFIG in
            find_package.<br>
            <br>
            But even with CONFIG I doesn't work for me.<br>
            <br>
            <br>
            Here my CMakeLists.txt:<br>
            <br>
            <br>
            cmake_minimum_required(VERSION 3.5.1)<br>
            project(SimpleProject)<br>
            <br>
            find_package(LLVM REQUIRED CONFIG PATHS
            "${CMAKE_CURRENT_SOURCE_DIR}/l<wbr>lvm/cmake$<br>
            <br>
            message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")<br>
            message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")<br>
            <br>
            include_directories(${LLVM_INC<wbr>LUDE_DIRS})<br>
            add_definitions(${LLVM_DEFINIT<wbr>IONS})<br>
            <br>
            add_executable(simple-tool main.cpp)<br>
            <br>
            llvm_map_components_to_libname<wbr>s(llvm_libs support)<br>
            <br>
            target_link_libraries(simple-t<wbr>ool ${llvm_libs})<br>
            <br>
            <br>
            Here part of the cmake output in terminal:<br>
            <br>
            CMake Error at CMakeLists.txt:4 (find_package):<br>
              Could not find a package configuration file provided by
            "LLVM" with any of<br>
              the following names:<br>
            <br>
                LLVMConfig.cmake<br>
                llvm-config.cmake<br>
            <br>
              Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH
            or set<br>
              "LLVM_DIR" to a directory containing one of the above
            files.  If "LLVM"<br>
              provides a separate development package or SDK, be sure it
            has been<br>
              installed.<br>
            <br>
            <br>
            -- Configuring incomplete, errors occurred!<br>
            See also "/home/timoo/Schreibtisch/buil<wbr>d/CMakeFiles/CMakeOutput.log"<br>
            <br>
            <br>
            I added the PATHS to find_package becouse the command must
            find the files.<br>
            <br>
            In the llvm/cmake/modules dircotry are:<br>
            <br>
            LLVM-Config.cmake (instead of lower case) and<br>
            <br>
            <a href="http://LLVMConfig.cmake.in" rel="noreferrer" target="_blank">LLVMConfig.cmake.in</a>
            (.in added at end)<br>
            <br>
            <br>
            So what must I do?
            <div class="m_8421636481832724823HOEnZb">
              <div class="m_8421636481832724823h5"><br>
                <br>
                <br>
                Am 09.10.2016 um 16:18 schrieb Timo Janssen:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  Hi all.<br>
                  <br>
                  <br>
                  I want to use llvm in my project and I want to make
                  llvm a git submodule in my project.<br>
                  <br>
                  <a href="http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project" rel="noreferrer" target="_blank">http://llvm.org/docs/CMake.htm<wbr>l#embedding-llvm-in-your-proje<wbr>ct</a><br>
                  <br>
                  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).<br>
                  <br>
                  <br>
                  Can someone tell me how to do it now.<br>
                  <br>
                  <br>
                  Timo Janssen<br>
                  <br>
                </blockquote>
                <br>
                ______________________________<wbr>_________________<br>
                LLVM Developers mailing list<br>
                <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
                <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>