[CMake] Include XYZ.cmake from external project

Matthias Möller mmoelle1 at gmail.com
Fri Apr 8 16:25:08 EDT 2016


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160408/34bbe516/attachment.html>


More information about the CMake mailing list