[CMake] ExternalProject_Add and Boost

Ben Medina ben.medina at gmail.com
Mon Jun 18 12:59:11 EDT 2012


> 4.       ExternalProject_Add will download, configure and build projects at
> ‘build’ time.  From the documentation, this sounded like a design decision.
> However, this means that you can’t use the already robust and mature
> findboost() module to configure the Boost project.  Would it be possible to
> add support to ExternalProject_Add to work at ‘configure’ time?

The approach that seems most common is to create a "superbuilder"
project that builds your dependencies as external projects, then
builds your own project (also as an external project) at the end.

On Sun, Jun 17, 2012 at 11:42 PM, Knox, Kent <Kent.Knox at amd.com> wrote:
> Hi all~
>
>
>
> I have been experimenting in my project with using ExternalProject_Add.  My
> goal is to make our build process more automated, with less headache to get
> up and started developing on a fresh system.  I decided that boost would be
> a great dependency to automate, which I successfully completed and is a HUGE
> help. I would like also like to ask the community to code review what I did,
> and possibly offer feedback.  I also have my own comments with the
> experience.
>
>
>
> My code for review (this was developed only for windows, for now):
>
>
>
> include( ExternalProject )
>
>
>
> set( Boost_Version 1.49.0 )
>
> string( REPLACE "." "_" Boost_Version_Underscore ${Boost_Version} )
>
>
>
> message( STATUS "Boost_Version: " ${Boost_Version} )
>
>
>
> # Below is a CMake command to download, build and install Boost on the
> user’s computer
>
> ExternalProject_Add(
>
> Boost
>
>                 PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/boost
>
>                 URL
> http://downloads.sourceforge.net/project/boost/boost/${Boost_Version}/boost_${Boost_Version_Underscore}.zip
>
>                 URL_MD5 854dcbbff31b896c85c38247060b7713
>
>                 UPDATE_COMMAND "bootstrap.bat"
>
>                 CONFIGURE_COMMAND ""
>
>                 BUILD_COMMAND bjam --with-program_options address-model=64
> toolset=msvc-11.0 link=static stage
>
>                 BUILD_IN_SOURCE 1
>
>                 INSTALL_COMMAND ""
>
> )
>
>
>
> set_property( TARGET Boost PROPERTY FOLDER "Externals")
>
>
>
> ExternalProject_Get_Property( Boost source_dir )
>
> ExternalProject_Get_Property( Boost binary_dir )
>
> set( Boost_INCLUDE_DIRS ${source_dir} )
>
> set( Boost_LIBRARIES
> debug;${binary_dir}/stage/lib/libboost_program_options-vc110-mt-gd-1_49.lib;optimized;${binary_dir}/stage/lib/libboost_program_options-vc110-mt-1_49.lib
> )
>
>
>
> A few of my comments while developing this.   Boost’s native build system is
> called Jam.  However, there are efforts to port Boost to cmake, available
> either on github or gitorious.  I would rather stick with one build system
> and use cmake, but I could not use either of these repositories with
> ExternalProject_Add.
>
> 1.       Github appears to only use the https protocol, and the cmake file(
> download … ) command does not appear to handle this protocol.  So, I think
> GitHub is verboten for any ExternalProject_Add.  Am I right, or am I missing
> something?  Any plans to add https support?
>
> 2.       ExternalProject_Add checks the file extension of the URL download,
> to ‘verify’ the download is a supported package.  I would actually like to
> request that it not verify the file extension.  A lot of these public code
> repositories offer tarball and zipball downloads, but the links they provide
> are forwarding scripts (and they don’t offer you direct links), and
> oftentimes the URL to use has no extension.  I had this problem with both
> github and gitorious.  I think it has to be left to the user to verify that
> the link they use if valid.
>
> 3.       The official subversion repository of boost offers .7z packages to
> download.  These packages are about half the size of .zips.  Will cmake add
> decompression support for 7z archives in the near future?
>
> 4.       ExternalProject_Add will download, configure and build projects at
> ‘build’ time.  From the documentation, this sounded like a design decision.
> However, this means that you can’t use the already robust and mature
> findboost() module to configure the Boost project.  Would it be possible to
> add support to ExternalProject_Add to work at ‘configure’ time?  Maybe a
> flag to choose when to pay the build cost?  This would help me abstract the
> differences between linux and windows, for instance.  I understand that some
> people care that ‘configure’ is fast, but I would prefer not to rewrite the
> logic already in the findboost packge.  Also, if ExternalProject_Add worked
> at ‘configure’ time, then I would think that it would be possible for the
> findboost package maintainer to incorporate ExternalProject_Add into the
> find module itself.  Then, users could pass a possible flag into findBoost
> that says, ‘if you don’t find boost locally on the system, just download the
> lastest version of boost for me and proceed with configuring.’
>
>
>
> Thanks in advance for comments,
>
> Kent
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list