[CMake] Fwd: Boost + CMake + Windows + Sanity -> Possible?

Chris Wilson chris+cmake at qwirx.com
Wed Aug 8 07:39:23 EDT 2018


Hi all,

I solved this problem (or a very similar one) by using a CMake superbuild
<https://github.com/boxbackup/boxbackup/blob/master/infrastructure/cmake/windows/CMakeLists.txt>
which builds Boost and then my project, like this:

# Version of Boost to download, unpack, and compile Box Backup against:
set(BOOST_VERSION    1.62.0)
# Hash of the Boost download file, to be verified after download:
set(BOOST_HASH SHA1=5fd97433c3f859d8cbab1eaed4156d3068ae3648)
...
string(REPLACE "." "_" BOOST_VERSION_UNDERSCORES ${BOOST_VERSION})
ExternalProject_Add(boost
URL "http://downloads.sourceforge.net/project/boost/boost/${
BOOST_VERSION}/boost_${BOOST_VERSION_UNDERSCORES}.tar.bz2"
URL_HASH ${BOOST_HASH}
# DOWNLOAD_NO_PROGRESS 1
# Disable automatic updating (untarring) as it's slow and not necessary
UPDATE_DISCONNECTED 1
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "No configure step needed"
BUILD_COMMAND ${CMAKE_COMMAND} -E echo "No build step needed"
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "No install step needed"
)
...
ExternalProject_Add(boxbackup
DEPENDS zlib openssl pcre boost
SOURCE_DIR ${boxbackup_dir}/infrastructure/cmake
CMAKE_ARGS
-DZLIB_ROOT=${install_dir}
-DOPENSSL_ROOT_DIR=${install_dir}
-DPCRE_ROOT=${install_dir}
*-DBOOST_ROOT=${CMAKE_BINARY_DIR}/Source/boost*
-DBOX_SUPPORT_READLINE=OFF
-DCMAKE_INSTALL_PREFIX=${install_dir}
-DAPPVEYOR_MODE=1
-DDEBUG=${DEBUG}
${boxbackup_cmake_args}
${SUB_CMAKE_EXTRA_ARGS}
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "No install step needed"
STEP_TARGETS configure build
)


Having set BOOST_ROOT, FindBoost should just work.

In this case, I didn't need to compile any of Boost, only its headers, but
if you do need to, then you can change its CONFIGURE_COMMAND and
BUILD_COMMAND.

Hope this helps.

Thanks, Chris.


On 8 August 2018 at 10:53, Wheeler, Gavin <gavin.wheeler at kcl.ac.uk> wrote:

> Hi Mateusz,
>
> I absolutely agree - use the latest CMake! That will help fix and bugs and
> ensure it works with more up-to-date versions of Boost.
>
> My cut and paste instructions were from 2 different computers, and the one
> I wrote the mail on has an older version of CMake - I wasn't suggesting
> people purposely use an old version, more to use the steps with the latest
> version. I've just got a new development machine - so now I'm working with
> new CMake :)
>
> So, if I may, I will add another step...
>
> 0. Download and install the latest CMake
>
> Thank-you,
>
> Gavin
>
>
> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Mateusz Loskot
> Sent: 07 August 2018 17:34
> To: cmake at cmake.org
> Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?
>
> On 7 August 2018 at 18:15, Wheeler, Gavin <gavin.wheeler at kcl.ac.uk> wrote:
> > [...]
> > 1.       Look in C:\Program
> > Files\CMake\share\cmake-3.9\Modules\FindBoost.cmake
>
> Rule #1: never use CMake older than the latest release!
>
> Rule #2: if you die hard for old CMake, force use of the latest
> FindBoost.cmake
>
> if (CMAKE_VERSION VERSION_LESS 3.12)
>   if (NOT EXISTS "${CMAKE_BINARY_DIR}/cmake/FindBoost.cmake")
>     message(STATUS "You are using CMake older than 3.10")
>     message(STATUS "FindBoost.cmake has likely been updated to detect
> newer or even not yet released Boost")
>     message(STATUS "Downloading FindBoost.cmake from
> https://emea01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fgitlab.kitware.com%2Fcmake%2F&data=01%7C01%
> 7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b2
> 15%7C8370cf1416f34c16b83c724071654356%7C0&sdata=2ORH%2Bn
> LCBqCDNIwIrs7%2FkcdPZhtP8hYE%2FVKrBe%2FYpDQ%3D&reserved=0 release
> branch")
>     message(STATUS "The auto-download can be disabled with
> GIL_DISABLE_FINDBOOST_DOWNLOAD=ON")
>     file(DOWNLOAD
>       "https://emea01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fraw%2Freleas
> e%2FModules%2FFindBoost.cmake&data=01%7C01%7Cgavin.
> wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C837
> 0cf1416f34c16b83c724071654356%7C0&sdata=W9QJth1ZQZiT2VlD
> aub2rUgsS8BnhT7Ps5STKlzqma8%3D&reserved=0"
>       "${CMAKE_BINARY_DIR}/cmake/FindBoost.cmake")
>   endif()
>   list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR}/cmake)
> endif()
>
>
> The rules work most of the time, unless a lil' bug sneaks in eg.
>
> https://emea01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fmerge_reques
> ts%2F1731&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C
> f685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c72407
> 1654356%7C0&sdata=MaRqgu7Rz8TwUvwQD%2FgIfm6bPje3spWfzDww
> A%2BIQ5rA%3D&reserved=0
> https://emea01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fissues%2F177
> 01&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba54
> 2e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%
> 7C0&sdata=eB9j5AGT7EW1TPeGXHxIyvstvLIjk8NlscleVeOPFJk%
> 3D&reserved=0
>
> Remember, FindBoost.cmake is *always* a step or two behind CMake release.
>
> Best regards,
> --
> Mateusz Loskot, https://emea01.safelinks.protection.outlook.com/?url=http%
> 3A%2F%2Fmateusz.loskot.net&data=01%7C01%7Cgavin.wheel
> er%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf14
> 16f34c16b83c724071654356%7C0&sdata=LyXA5Iv76X0qxQKYT1ts
> 6%2Fvtc%2F2v%2BEa9g778QoL6%2BdI%3D&reserved=0
> --
>
> Powered by https://emea01.safelinks.protection.outlook.com/?url=www.
> kitware.com&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C
> f685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c72407
> 1654356%7C0&sdata=%2BUZyhXV9EXuLreYKa2Kx9yAnlzN9X5%
> 2Fpw8%2FeV%2BUrCoE%3D&reserved=0
>
> Please keep messages on-topic and check the CMake FAQ at:
> https://emea01.safelinks.protection.outlook.com/?url=http%
> 3A%2F%2Fwww.cmake.org%2FWiki%2FCMake_FAQ&data=01%7C01%
> 7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b2
> 15%7C8370cf1416f34c16b83c724071654356%7C0&sdata=L2gB6A4D
> MwOI%2BwD%2FK2lwDRQf%2BaHJ4K9gi52cYRG2fSk%3D&reserved=0
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: https://emea01.safelinks.protection.outlook.com/?url=http%
> 3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fsupport.html&
> data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e784971
> 3baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&
> sdata=Tjljc0Fic6aB7lm2Idu0TOj%2B2MAT8iGNBESYsJ0rqR4%3D&reserved=0
> CMake Consulting: https://emea01.safelinks.prote
> ction.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%
> 2Fhelp%2Fconsulting.html&data=01%7C01%7Cgavin.wheeler%
> 40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f
> 34c16b83c724071654356%7C0&sdata=jeQYQWP0dYxBfc6vF7gSllG3
> k%2BDxmSjufD8h58SWOkA%3D&reserved=0
> CMake Training Courses: https://emea01.safelinks.prote
> ction.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%
> 2Fhelp%2Ftraining.html&data=01%7C01%7Cgavin.wheeler%
> 40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f
> 34c16b83c724071654356%7C0&sdata=JmQKOS6nZLEMKNi%2BS02znt
> 9SX1fEDT9hBNfMJm89Lt0%3D&reserved=0
>
> Visit other Kitware open-source projects at https://emea01.safelinks.prote
> ction.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopen
> source%2Fopensource.html&data=01%7C01%7Cgavin.wheeler%
> 40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f
> 34c16b83c724071654356%7C0&sdata=01SHgapkca41kiv%2FRNuTM4
> DGl0rljDn6Vc1a70ZSSKg%3D&reserved=0
>
> Follow this link to subscribe/unsubscribe:
> https://emea01.safelinks.protection.outlook.com/?url=https%
> 3A%2F%2Fcmake.org%2Fmailman%2Flistinfo%2Fcmake&data=
> 01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08
> d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=
> Q9Nrpc%2FA52FFCvo%2B3JCU5XWBWMFqbtiq6OvG2Oc3pvA%3D&reserved=0
> --
>
> 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/opensou
> rce/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/20180808/e80fad62/attachment-0001.html>


More information about the CMake mailing list