Hi Stephane.

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).

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.

I think googling "CMake ExternalProject_Add superbuild" will give you
enough details to get you going.

Petr

On 2 May 2018 at 10:31, Stéphane Ancelot <sance...@numalliance.com> wrote:

> include(ExternalProject)
>
> ExternalProject_Add(
>     WIN32DEPSV2
>     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/WIN32DEPSV2
>     DOWNLOAD_DIR .
>     STAMP_DIR ./stamps
>     SOURCE_DIR   WIN32DEPSV2
>     GIT_REPOSITORY g...@numagit.numalliance.com:THIRD_PARTIES/WIN32DEPS.git
>     CONFIGURE_COMMAND ""
>     BUILD_COMMAND ""
>     BUILD_IN_SOURCE 1
>     INSTALL_COMMAND ""
> )
>
> add_library(your_other_target ...)
>
> add_dependencies(your_other_target WIN32DEPSV2)
>
> find_package(Freetype REQUIRED QUIET)
>
> Launching cmake does not clone the git folder , but continues and fails
> with the find_package command
>
> CMake Error at /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/
> Modules/FindPackageHandleStandardArgs.cmake:137 (message):
>   Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
> Call Stack (most recent call first):
>   /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/
> FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
>   
> /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/FindFreetype.cmake:157
> (find_package_handle_standard_args)
>   FOX64/CMakeLists.txt:919 (find_package)
>
> Le 02/05/2018 à 09:32, Kai Wolf a écrit :
>
> You probably need to manually add a dependency from your ExternalProject
> to your target that needs the libraries.
> For instance
>
>     ExternalProject_Add(fetch_win32_libs ...)
>     add_library(your_other_target ...)
>
>
> Greetings
>
> Kai Wolf
>
> http://kai-wolf.me/
> kai.w...@gmail.com
>
> 2018-05-02 8:47 GMT+02:00 Stéphane Ancelot <sance...@numalliance.com>:
>
>> Hi,
>>
>> I have got some win32 libraries dependencies stored in a project .
>>
>> Then I added ExternalProject_Add at beginning of my cmakelists file in
>> order to clone this dependency to be available.
>>
>> and then provide the root path as follow:
>>
>> SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/JPEGLIB/jpegsrc-9c
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/zlib-1.2.3-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/libpng-1.2.37-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/ftgl-binary
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/freetype-dev_2.4.2-1
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/iconv-1.9.2.1
>>                         )
>>
>>
>> unfortunately, the project is not cloned when cmake is launched and the
>> next dependencies don't find the packages :-(
>>
>> What Can I do ?
>>
>> Regards,
>>
>> S.Ancelot
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to