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

Wheeler, Gavin gavin.wheeler at kcl.ac.uk
Thu Aug 9 05:40:32 EDT 2018


Hi Chris,

Thanks fort that suggestion too. Right now I have boost integrated using the pre-built libs and the program I need it for is working - so I’m loath to change it.

However, I’ll keep this for future reference, I’m sure it will come in handy.

Best Regards,

Gavin

From: chris at simply-italian.co.uk <chris at simply-italian.co.uk> On Behalf Of Chris Wilson
Sent: 08 August 2018 12:29
To: Wheeler, Gavin <gavin.wheeler at kcl.ac.uk>
Cc: cmake at cmake.org
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

Hi all,

I solved this problem (or a very similar one) by using a CMake superbuild<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fboxbackup%2Fboxbackup%2Fblob%2Fmaster%2Finfrastructure%2Fcmake%2Fwindows%2FCMakeLists.txt&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=mlCc8Yqqnmxo7yaEg3SzuAg%2FGvYXseuo7WW5YgGkQw4%3D&reserved=0> 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<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdownloads.sourceforge.net%2Fproject%2Fboost%2Fboost%2F%24%7BBOOST_VERSION%7D%2Fboost_%24%7BBOOST_VERSION_UNDERSCORES%7D.tar.bz2&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=3jIIq9zc4JfBlW0Owf39zmKTDK%2BW%2FFQsnFcESEryyd0%3D&reserved=0>"
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<mailto: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<mailto:cmake-bounces at cmake.org>] On Behalf Of Mateusz Loskot
Sent: 07 August 2018 17:34
To: cmake at cmake.org<mailto: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<mailto: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%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=2ORH%2BnLCBqCDNIwIrs7%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%2Frelease%2FModules%2FFindBoost.cmake&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=W9QJth1ZQZiT2VlDaub2rUgsS8BnhT7Ps5STKlzqma8%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_requests%2F1731&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=MaRqgu7Rz8TwUvwQD%2FgIfm6bPje3spWfzDwwA%2BIQ5rA%3D&reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fissues%2F17701&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%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.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=LyXA5Iv76X0qxQKYT1ts6%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%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%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%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=L2gB6A4DMwOI%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%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=Tjljc0Fic6aB7lm2Idu0TOj%2B2MAT8iGNBESYsJ0rqR4%3D&reserved=0
CMake Consulting: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=jeQYQWP0dYxBfc6vF7gSllG3k%2BDxmSjufD8h58SWOkA%3D&reserved=0
CMake Training Courses: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=JmQKOS6nZLEMKNi%2BS02znt9SX1fEDT9hBNfMJm89Lt0%3D&reserved=0

Visit other Kitware open-source projects at https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=01SHgapkca41kiv%2FRNuTM4DGl0rljDn6Vc1a70ZSSKg%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%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&sdata=Q9Nrpc%2FA52FFCvo%2B3JCU5XWBWMFqbtiq6OvG2Oc3pvA%3D&reserved=0
--

Powered by www.kitware.com<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=%2BDwnlxYPXo%2B7XtvQDWNmVyzoRsxjEmRNMp4VV9Pv0QQ%3D&reserved=0>

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cmake.org%2FWiki%2FCMake_FAQ&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=YDZkz8jfLRTremn5U1y89qn%2BaOSaKx4g%2FNlzwx0yJHA%3D&reserved=0>

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<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fsupport.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=GlAgHdttNOHHCX%2FXXORVO2lLNR%2BoVXrOPdnvTXV9OXE%3D&reserved=0>
CMake Consulting: http://cmake.org/cmake/help/consulting.html<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=2jZOeYDHH0mSCUu%2B%2B4YKfkotLUtm7gZe4Xwtajm7AyQ%3D&reserved=0>
CMake Training Courses: http://cmake.org/cmake/help/training.html<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=qkNgoY4w3N0kZWiY716v1molKMcDWyZxSmI8nzU6p70%3D&reserved=0>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=HgYjbH3ThP1dAGUdVFUy4QDtGA2UvbEilHNxMNAgMQ8%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcmake.org%2Fmailman%2Flistinfo%2Fcmake&data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7C15ca36a76a0a473b2b5208d5fd222ce3%7C8370cf1416f34c16b83c724071654356%7C0&sdata=1BdLPbBlD9ekWN3DNL%2FnS1dqIQmf8jHzuAegkdg5wDs%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180809/d83e9771/attachment-0001.html>


More information about the CMake mailing list