<div dir="ltr"><div><div><div><div>Hi Stephane.<br><br></div>ExternalProject is designed to run at *build* time, not at *CMake* time. It is not really intended for mixing with normal, non-ExternalProject targets (such as those created by add_library).<br><br></div>When using ExternalProject, the canonical form of operation is a SuperBuild-style project: your master CMakeLists.txt will contain only ExternalProject_Add() calls, *including one for your normal project.* Your normal project becomes just another project managed by the SuperBuild. The SuperBuild's purpose is to download, configure, build, etc., all the subprojects. So you generate the SuperBuild and then build it once to get all the dependencies in place. The you switch to using just the YourProject "child" of the SuperBuild and do normal development there.<br><br></div>I think googling "CMake ExternalProject_Add superbuild" will give you enough details to get you going.<br><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 May 2018 at 10:31, Stéphane Ancelot <span dir="ltr"><<a href="mailto:sancelot@numalliance.com" target="_blank">sancelot@numalliance.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>include(ExternalProject)<br>
      <br>
      ExternalProject_Add(<br>
          WIN32DEPSV2<br>
          PREFIX ${CMAKE_CURRENT_BINARY_DIR}/<wbr>WIN32DEPSV2<br>
          DOWNLOAD_DIR .<br>
          STAMP_DIR ./stamps<br>
          SOURCE_DIR   WIN32DEPSV2<br>
          GIT_REPOSITORY
      <a class="m_1851260698944910117moz-txt-link-abbreviated" href="mailto:git@numagit.numalliance.com:THIRD_PARTIES/WIN32DEPS.git" target="_blank">git@numagit.numalliance.com:<wbr>THIRD_PARTIES/WIN32DEPS.git</a><br>
          CONFIGURE_COMMAND ""<br>
          BUILD_COMMAND ""<br>
          BUILD_IN_SOURCE 1<br>
          INSTALL_COMMAND ""<br>
      )                       <br>
    </p>
    <p>add_library(your_other_target ...)</p>
    <p>add_dependencies(your_other_<wbr>target WIN32DEPSV2)</p>
    <p>find_package(Freetype REQUIRED QUIET)<br>
    </p>
    <br>
    Launching cmake does not clone the git folder , but continues and
    fails with the find_package command<br>
    <br>
    CMake Error at
/usr/local/cmake-3.10.3-Linux-<wbr>x86_64/share/cmake-3.10/<wbr>Modules/<wbr>FindPackageHandleStandardArgs.<wbr>cmake:137
    (message):<br>
      Could NOT find Freetype (missing: FREETYPE_LIBRARY
    FREETYPE_INCLUDE_DIRS)<br>
    Call Stack (most recent call first):<br>
     
/usr/local/cmake-3.10.3-Linux-<wbr>x86_64/share/cmake-3.10/<wbr>Modules/<wbr>FindPackageHandleStandardArgs.<wbr>cmake:378
    (_FPHSA_FAILURE_MESSAGE)<br>
     
/usr/local/cmake-3.10.3-Linux-<wbr>x86_64/share/cmake-3.10/<wbr>Modules/FindFreetype.cmake:157
    (find_package_handle_standard_<wbr>args)<br>
      FOX64/CMakeLists.txt:919 (find_package)<span class=""><br>
    <br>
    <div class="m_1851260698944910117moz-cite-prefix">Le 02/05/2018 à 09:32, Kai Wolf a
      écrit :<br>
    </div>
    </span><blockquote type="cite">
      <div dir="ltr"><span class="">
        <div class="gmail_default" style="font-family:tahoma,sans-serif">You
          probably need to manually add a dependency from your
          ExternalProject to your target that needs the libraries.<br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">For
          instance<br>
          <br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">   
          ExternalProject_Add(fetch_<wbr>win32_libs ...)<br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">   
          add_library(your_other_target ...)<br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
          <br>
        </div>
        </span><div><div class="h5"><div class="gmail_default" style="font-family:tahoma,sans-serif">Greetings<br>
        </div>
        <div class="gmail_extra"><br clear="all">
          <div>
            <div class="m_1851260698944910117gmail_signature" data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div><span style="font-family:tahoma,sans-serif">Kai
                        Wolf<br>
                        <br>
                      </span>
                      <span style="font-family:tahoma,sans-serif"><a href="http://kai-wolf.me/" target="_blank">http://kai-wolf.me/</a><br>
                      </span></div>
                    <span style="font-family:tahoma,sans-serif"><a href="mailto:kai.wolf@gmail.com" target="_blank">kai.wolf@gmail.com</a><br>
                    </span></div>
                </div>
              </div>
            </div>
          </div>
          <br>
          <div class="gmail_quote">2018-05-02 8:47 GMT+02:00 Stéphane
            Ancelot <span dir="ltr"><<a href="mailto:sancelot@numalliance.com" target="_blank">sancelot@numalliance.com</a>></span>:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
              <br>
              I have got some win32 libraries dependencies stored in a
              project .<br>
              <br>
              Then I added ExternalProject_Add at beginning of my
              cmakelists file in order to clone this dependency to be
              available.<br>
              <br>
              and then provide the root path as follow:<br>
              <br>
              SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/JPEGLIB/jpegsrc-9c<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/zlib-1.2.3-lib<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/libpng-1.2.37-lib<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/ftgl-binary<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/freetype-dev_2.4.2-1<br>
              ${CMAKE_CURRENT_SOURCE_DIR}/WI<wbr>N32DEPS/iconv-1.9.2.1<br>
                                      )<br>
              <br>
              <br>
              unfortunately, the project is not cloned when cmake is
              launched and the next dependencies don't find the packages
              :-(<br>
              <br>
              What Can I do ?<br>
              <br>
              Regards,<br>
              <br>
              S.Ancelot<br>
              -- <br>
              <br>
              Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
              <br>
              Please keep messages on-topic and check the CMake FAQ at:
              <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMak<wbr>e_FAQ</a><br>
              <br>
              Kitware offers various services to support the CMake
              community. For more information on each offering, please
              visit:<br>
              <br>
              CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/su<wbr>pport.html</a><br>
              CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/co<wbr>nsulting.html</a><br>
              CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/tr<wbr>aining.html</a><br>
              <br>
              Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
              <br>
              Follow this link to subscribe/unsubscribe:<br>
              <a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/list<wbr>info/cmake</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </div></div></div>
    </blockquote>
    <br>
  </div>

<br>-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/<wbr>listinfo/cmake</a><br>
<br></blockquote></div><br></div>