using variables in ExternalProject_Add arguments

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

using variables in ExternalProject_Add arguments

Kris Thielemans-2

Dear all

 

We have a Superbuild https://github.com/CCPPETMR/SIRF-SuperBuild. I’m trying to introduce variables to reduce duplication. However, I’m getting weird errors. 2 examples below. Any ideas? (I’m running this on Windows 10 at present with CMake 3.13.2).

 

Many thanks

Kris

 

  1. Use of a variable for CMAKE_ARGS

 

ExternalProject_Add(${proj}

    ${${proj}_EP_ARGS}

    GIT_REPOSITORY ${${proj}_URL}

    GIT_TAG ${${proj}_TAG}

    CMAKE_ARGS

            ${HDF5_CMAKE_ARGS}

            -DBOOST_ROOT=${BOOST_ROOT}

    INSTALL_DIR ${ISMRMRD_Install_Dir}

 

With

HDF5_CMAKE_ARGS=-DHDF5_ROOT:PATH=C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/INSTALL

       -DHDF5_INCLUDE_DIRS:PATH=C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/INSTALL/include

       -DHDF5_FIND_DEBUG:BOOL=ON

 

Error:

5>  Performing configure step for 'ISMRMRD'

5>CUSTOMBUILD : CMake error : The source directory "C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/builds/ISMRMRD/build" does not appear to contain CMakeLists.txt.

 

Indeed, that directory is where we sk the SuperBuild to build. The sources sit in …SIRF-SuperBuild/sources/ISMRMRD. Why does it go to the build directory?

All works ok  when commenting out the HDF5_CMAKE_ARGS line, or by putting its value directly in the ExternalProject_Add.

 

 

  1. Use of a variable for PATCH_COMMAND

 

find_program(GIT "git")

set(PATCH_COMMAND "${GIT} apply ${PATCHFILE}")

 

  ExternalProject_Add(${proj}

    ${${proj}_EP_ARGS}

    URL ${${proj}_URL}

    URL_HASH MD5=${${proj}_MD5}

    PATCH_COMMAND ${PATCH_COMMAND}

    ...

   )

 

Error:

2>  Performing patch step for 'HDF5'

2>  The filename, directory name, or volume label syntax is incorrect.

 

Everything works fine if I use

   PATCH_COMMAND ${GIT} apply ${PATCHFILE}

 


--

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 | Threaded
Open this post in threaded view
|

Re: using variables in ExternalProject_Add arguments

Kris Thielemans-2

Dear all

 

I’ve managed to resolve this. My mistake was to use quotes:

 

WRONG:

  set(HDF5_CMAKE_ARGS

    "-DHDF5_ROOT:PATH=${HDF5_ROOT}

     -DHDF5_INCLUDE_DIRS:PATH=${HDF5_INCLUDE_DIRS}

     -DHDF5_FIND_DEBUG:BOOL=ON"

  )

 

CORRECT:

  set(HDF5_CMAKE_ARGS

     -DHDF5_ROOT:PATH=${HDF5_ROOT}

     -DHDF5_INCLUDE_DIRS:PATH=${HDF5_INCLUDE_DIRS}

     -DHDF5_FIND_DEBUG:BOOL=ON

  )

 

 

WRONG:

set(PATCH_COMMAND "${GIT} apply ${PATCHFILE}")

 

CORRECT:

set(PATCH_COMMAND ${GIT} apply ${PATCHFILE})

 

Kris

 

From: Kris Thielemans <[hidden email]>
Sent: 21 June 2019 16:19
To: 'CMake Mail List' <[hidden email]>
Subject: using variables in ExternalProject_Add arguments

 

Dear all

 

We have a Superbuild https://github.com/CCPPETMR/SIRF-SuperBuild. I’m trying to introduce variables to reduce duplication. However, I’m getting weird errors. 2 examples below. Any ideas? (I’m running this on Windows 10 at present with CMake 3.13.2).

 

Many thanks

Kris

 

  1. Use of a variable for CMAKE_ARGS

 

ExternalProject_Add(${proj}

    ${${proj}_EP_ARGS}

    GIT_REPOSITORY ${${proj}_URL}

    GIT_TAG ${${proj}_TAG}

    CMAKE_ARGS

            ${HDF5_CMAKE_ARGS}

            -DBOOST_ROOT=${BOOST_ROOT}

    INSTALL_DIR ${ISMRMRD_Install_Dir}

 

With

HDF5_CMAKE_ARGS=-DHDF5_ROOT:PATH=C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/INSTALL

       -DHDF5_INCLUDE_DIRS:PATH=C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/INSTALL/include

       -DHDF5_FIND_DEBUG:BOOL=ON

 

Error:

5>  Performing configure step for 'ISMRMRD'

5>CUSTOMBUILD : CMake error : The source directory "C:/Users/krisf/Documents/devel/build-VC/SIRF-SuperBuild/builds/ISMRMRD/build" does not appear to contain CMakeLists.txt.

 

Indeed, that directory is where we sk the SuperBuild to build. The sources sit in …SIRF-SuperBuild/sources/ISMRMRD. Why does it go to the build directory?

All works ok  when commenting out the HDF5_CMAKE_ARGS line, or by putting its value directly in the ExternalProject_Add.

 

 

  1. Use of a variable for PATCH_COMMAND

 

find_program(GIT "git")

set(PATCH_COMMAND "${GIT} apply ${PATCHFILE}")

 

  ExternalProject_Add(${proj}

    ${${proj}_EP_ARGS}

    URL ${${proj}_URL}

    URL_HASH MD5=${${proj}_MD5}

    PATCH_COMMAND ${PATCH_COMMAND}

    ...

   )

 

Error:

2>  Performing patch step for 'HDF5'

2>  The filename, directory name, or volume label syntax is incorrect.

 

Everything works fine if I use

   PATCH_COMMAND ${GIT} apply ${PATCHFILE}

 


--

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