[CMake] Include XYZ.cmake from external project

Nicholas Braden nicholas11braden at gmail.com
Fri Apr 8 16:27:19 EDT 2016


To solve the dependency order problem, generally you would make a
superbuild which builds your dependencies and also your own project
via ExternalProject, using the DEPENDS option to guarantee build
order. This way all your dependencies are fully built and installed
before it even gets to configuring your own project.

On Fri, Apr 8, 2016 at 3:25 PM, Matthias Möller <mmoelle1 at gmail.com> wrote:
> Dear all,
>
> I have difficulties including a XYZ.cmake file from an external project.
>
> ExternalProject_Add(MTL4
>     SVN_REPOSITORY    https://simunova.zih.tu-dresden.de/svn/mtl4/trunk
>     SVN_USERNAME      guest
>     SVN_PASSWORD      guest
>     SVN_TRUST_CERT    1
>     TIMEOUT           180
>     PREFIX            ${CMAKE_BINARY_DIR}/external/MTL4
>     CONFIGURE_COMMAND ""
>     BUILD_COMMAND     ""
>     INSTALL_COMMAND   “"
> )
>
> ExternalProject_Get_Property(MTL4 source_dir)
> set(MTL4_INCLUDE_DIRS ${source_dir})
> set(MTL_DIR ${source_dir})
>
> # Include MTLConfig from the unpacked(!!!) MTL4 library
> include("${source_dir}/MTLConfig.cmake" OPTIONAL RESULT_VARIABLE
> MTLCONFIG_FOUND)
>
>
> # MTL4 is a header-only library, hence downloading and unpacking is
> sufficient
> add_executable (demo demo.cxx)
> add_dependencies(demo MTL4)
>
> The problem is, that in a fresh build the MTL4 library is not yet unpacked,
> and hence, the MTLConfig.cmake file is not available.
> How can I “include(…)” a cmake file which is only available after the
> external project has been processed?
>
> Kind regards,
> Matthias
>
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list