[CMake] Relaying all command line arguments from SuperBuild to ExternalProject_Add

J Decker d3ck0r at gmail.com
Wed Jan 31 15:27:14 EST 2018


(platfrom defines is a variable suitable for like ADD_DEFINITIONS(
${PLATFORM_DEFINES} )


  string( REPLACE ";" " " PLATFORM_DEFINES_ARG "${PLATFORM_DEFINES}" )
  ExternalProject_Add( target
    ....
CMAKE_ARGS -DPLATFORM_DEFINES=${PLATFORM_DEFINES_ARG}
    ......
 )


and in the target cmakelists to use the argument


STRING( REPLACE " " ";" PLATFORM_DEFINES ${PLATFORM_DEFINES} )

add_definitions( ${PLATFORM_DEFINES} )



On Wed, Jan 31, 2018 at 9:36 AM, Saad Khattak <saadrustam at gmail.com> wrote:

> I have the following setup:
> Superbuild
>    - ExternalProject_Add(a...)
>    - ExternalProject_Add(b...)
>    - ExternalProject_Add(c...)
>    - ExternalProject_Add(d...)
>
> The SuperBuild is built from command line with some options e.g.
> -DMY_OPTION=TRUE. I would like all these options to be passed to each of
> the ExternalProject_Add CMAKE_ARGS.
>
> I tried to capture the arguments using the solution posted here:
> https://stackoverflow.com/a/10218582/368599
>
> The arguments are captured properly (i.e. I printed them out to make sure
> they are correct) but relaying them to ExternalProject_Add appears to be
> problematic. I tried the following ways to forward the arguments (as
> outlined in the stackoverflow solution):
>
> ExternalProject_Add(...
>   CMAKE_ARGS ${CMAKE_ARGS}
>   )
>
> ExternalProject_Add(...
>   CMAKE_ARGS "${CMAKE_ARGS}" # quotes
>   )
>
> ExternalProject_Add(...
>   CMAKE_ARGS "${MY_CMAKE_ARGS}" # changed the variable name in case it
> conflicts
>   )
>
> None of that seems to work. CMake appears to ignore the commands forwarded.
>
> Is there something I am missing?
>
> Thanks,
> Saad
>
>
> --
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180131/a4e586b0/attachment-0001.html>


More information about the CMake mailing list