Boost + CMake + Windows + Sanity -> Possible?

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

Boost + CMake + Windows + Sanity -> Possible?

Wheeler, Gavin

Hello! First the short version...

Can anyone give me a set of instructions to download, build and setup the latest Boost (currently 1.67) on Windows 10 for VS 2017 64bit such that the following will work...

    find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time iostreams)
    include_directories(${Boost_INCLUDE_DIRS})
    link_directories(${Boost_LIBRARY_DIRS})

Including...

- Steps to follow when building and installing Boost
- What environment variables to set and what to set them to, e.g. boost, boost library, boost include directories
- What to set in the CMake file so that Boost will be correctly included

I ask about building Boost as well as CMake because it seems to me that unless Boost is built in a way that matches CMake expectations it just won't work.

Some background...

I've inherited a project with the above in, along with depndencies on ITK, VTK and zlib - all of which I have set up in CMake OK. However, Boost appears to be immune to working with CMake. There are various suggestions on the web, but nothing consistent, and nothing I've found whcih will work.

I've spent 2 days building Boost (this isn't solely due to CMake, the Boost build instructions are all over the place and their latest installer contains a trojan according to Windows defender) and configuring CMake in various ways, getting frustrated setting various environmental variables, and the nebulous target that is a Boost source install.

I can fix this by manually setting all of the library paths and doing some fixing up in the resultant project files, but I shouldn't really have to.

Surely it shouldn't be this difficult! Hopefully if there is a clear set of instructions from start to finish it will save others future anguish.

For building Boost I ended up using b2 and the following steps install (based on https://www.boost.org/doc/libs/1_67_0/more/getting_started/windows.html) and having tried following the instructions to the letter I ended up with...

- Download Boost, e.g. from https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.7z
- Extract to e.g. C:\thirdparty\boost\boost_1_67_0
- Build the bootstrapper, as per section 5.2.1 in https://www.boost.org/doc/libs/1_67_0/more/getting_started/windows.html
- Build the binaries, simlar to section 5.2.2 in the above, but using
    - b2 --build-dir=C:\thirdparty\boost-install\boost_1_67_0 toolset=msvc --build-type=complete install
- Why the change?
    - Building the Boost build tools didn't seem to affect the building of the install
    - The inital install command in their instructions didn't seem to actually install the headers and libs
    - Using stage only seems to collect the lib files together, not the headers
    - So I end up with a libs folder and an include folder

I then try to set the following environment variables (as system ones, rather than as user ones)

- BOOST_ROOT - to the boost folder of the downloaded and extracted boost
- BOOST_INCLUDEDIR - to the include folder of the installed boost
- BOOST_LIBRARYDIR - the the lib folder of the installed boost

As well as lots of other directories which seemed like they might work.

Then in the CMake (based upon suggestions from the web) I've tried things like...

set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)

...and...

SET(Boost_ADDITIONAL_VERSIONS "1.67" "1.67.0")

...and...

set (Boost_DETAILED_FAILURE_MSG ON)
set (BOOST_DEBUG ON)

... to no avail








--

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: Boost + CMake + Windows + Sanity -> Possible?

Innokentiy Alaytsev
Hello!

First of all, I suggest you use Boost imported targets instead of
Boost_INCLUDE_DIRS and Boost_LIBRARY_DIRS and the
target_include_directories() and target_link_libraries() functions. Al this
is to better support exporting CMake package if you need it. If you do not
produce CMake package for use in some other projects, then just ignore this
advice.

Second, just use  pre-built Boost binaries
<https://dl.bintray.com/boostorg/release/1.67.0/binaries/>  . They are just
fine. If your Windows Defender finds something in them then it's the problem
in Windows Defender.

Best regards,
Innokentiy Alaytsev



--
Sent from: http://cmake.3232098.n2.nabble.com/
--

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: Boost + CMake + Windows + Sanity -> Possible?

Dvir Yitzchaki

I recommend using Hunter package manager:

https://docs.hunter.sh/en/latest/quick-start/boost-components.html

 

Regards,

Dvir

 

-----Original Message-----
From: CMake <[hidden email]> On Behalf Of Innokentiy Alaytsev
Sent: Thursday, July 12, 2018 13:29
To: [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

 

Hello!

 

First of all, I suggest you use Boost imported targets instead of Boost_INCLUDE_DIRS and Boost_LIBRARY_DIRS and the

target_include_directories() and target_link_libraries() functions. Al this is to better support exporting CMake package if you need it. If you do not produce CMake package for use in some other projects, then just ignore this advice.

 

Second, just use  pre-built Boost binaries <https://dl.bintray.com/boostorg/release/1.67.0/binaries/>  . They are just fine. If your Windows Defender finds something in them then it's the problem in Windows Defender.

 

Best regards,

Innokentiy Alaytsev

 

 

 

--

Sent from: http://cmake.3232098.n2.nabble.com/

--

 

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


--

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: Boost + CMake + Windows + Sanity -> Possible?

Wheeler, Gavin

Hi,

 

Thanks for the suggestions and apologies for my tardiness in getting back on this issue. I’m replying with my experiences for other to use as a future reference, hopefully they can avoid some of the frustration I’ve encountered.

 

I spent half a day on this with two colleagues who are well versed in using CMake, and we found a simple solution.

 

DON’T BOTHER!

 

“Windows + CMake + source boost “build seems intractable, or at the very least intractable enough to basically be impossible, or at any rate just not worth bothering with.

 

If are using Windows and you rate your sanity and time higher than you rate the ability to use CMake and a source build of boost together I suggest you do the following...

 

1.       Look in C:\Program Files\CMake\share\cmake-3.9\Modules\FindBoost.cmake

2.       Search for _Boost_KNOWN_VERSIONS

3.       Download the binary build of the newest version listed from https://sourceforge.net/projects/boost/files/boost-binaries/

4.       If Windows Defender has a wobbly and your IT policy won’t allow you to ignore the wobble then move back thorugh older versions until one works

5.       Install the boost to the default location and default settings

6.       Run CMake with the following sort of thing...

 

    find_package(Boost REQUIRED COMPONENTS system filesystem thread date_time iostreams)
    include_directories(${Boost_INCLUDE_DIRS})
    link_directories(${Boost_LIBRARY_DIRS})

 

7.       ...relax and make a nice cup of tea

 

Best Regards,

 

Gavin

 

 

From: CMake [mailto:[hidden email]] On Behalf Of Dvir Yitzchaki
Sent: 15 July 2018 08:27
To: Innokentiy Alaytsev <[hidden email]>; [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

 

I recommend using Hunter package manager:

https://docs.hunter.sh/en/latest/quick-start/boost-components.html

 

Regards,

Dvir

 

-----Original Message-----
From: CMake <
[hidden email]> On Behalf Of Innokentiy Alaytsev
Sent: Thursday, July 12, 2018 13:29
To:
[hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

 

Hello!

 

First of all, I suggest you use Boost imported targets instead of Boost_INCLUDE_DIRS and Boost_LIBRARY_DIRS and the

target_include_directories() and target_link_libraries() functions. Al this is to better support exporting CMake package if you need it. If you do not produce CMake package for use in some other projects, then just ignore this advice.

 

Second, just use  pre-built Boost binaries <https://dl.bintray.com/boostorg/release/1.67.0/binaries/>  . They are just fine. If your Windows Defender finds something in them then it's the problem in Windows Defender.

 

Best regards,

Innokentiy Alaytsev

 

 

 

--

Sent from: http://cmake.3232098.n2.nabble.com/

--

 

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


--

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: Boost + CMake + Windows + Sanity -> Possible?

Mateusz Loskot
On 7 August 2018 at 18:15, Wheeler, Gavin <[hidden email]> 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://gitlab.kitware.com/cmake/ release branch")
    message(STATUS "The auto-download can be disabled with
GIL_DISABLE_FINDBOOST_DOWNLOAD=ON")
    file(DOWNLOAD
      "https://gitlab.kitware.com/cmake/cmake/raw/release/Modules/FindBoost.cmake"
      "${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://gitlab.kitware.com/cmake/cmake/merge_requests/1731
https://gitlab.kitware.com/cmake/cmake/issues/17701

Remember, FindBoost.cmake is *always* a step or two behind CMake release.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
--

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
--
Mateusz Loskot
http://mateusz.loskot.net
Reply | Threaded
Open this post in threaded view
|

Re: Boost + CMake + Windows + Sanity -> Possible?

Wheeler, Gavin
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:[hidden email]] On Behalf Of Mateusz Loskot
Sent: 07 August 2018 17:34
To: [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

On 7 August 2018 at 18:15, Wheeler, Gavin <[hidden email]> 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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=2ORH%2BnLCBqCDNIwIrs7%2FkcdPZhtP8hYE%2FVKrBe%2FYpDQ%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=W9QJth1ZQZiT2VlDaub2rUgsS8BnhT7Ps5STKlzqma8%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=MaRqgu7Rz8TwUvwQD%2FgIfm6bPje3spWfzDwwA%2BIQ5rA%3D&amp;reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fissues%2F17701&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=eB9j5AGT7EW1TPeGXHxIyvstvLIjk8NlscleVeOPFJk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=LyXA5Iv76X0qxQKYT1ts6%2Fvtc%2F2v%2BEa9g778QoL6%2BdI%3D&amp;reserved=0
--

Powered by https://emea01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=%2BUZyhXV9EXuLreYKa2Kx9yAnlzN9X5%2Fpw8%2FeV%2BUrCoE%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=L2gB6A4DMwOI%2BwD%2FK2lwDRQf%2BaHJ4K9gi52cYRG2fSk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Tjljc0Fic6aB7lm2Idu0TOj%2B2MAT8iGNBESYsJ0rqR4%3D&amp;reserved=0
CMake Consulting: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=jeQYQWP0dYxBfc6vF7gSllG3k%2BDxmSjufD8h58SWOkA%3D&amp;reserved=0
CMake Training Courses: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=JmQKOS6nZLEMKNi%2BS02znt9SX1fEDT9hBNfMJm89Lt0%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=01SHgapkca41kiv%2FRNuTM4DGl0rljDn6Vc1a70ZSSKg%3D&amp;reserved=0

Follow this link to subscribe/unsubscribe:
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcmake.org%2Fmailman%2Flistinfo%2Fcmake&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Q9Nrpc%2FA52FFCvo%2B3JCU5XWBWMFqbtiq6OvG2Oc3pvA%3D&amp;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/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

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

Chris Wilson
Hi all,

I solved this problem (or a very similar one) by using a CMake superbuild 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_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 <[hidden email]> 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:[hidden email]] On Behalf Of Mateusz Loskot
Sent: 07 August 2018 17:34
To: [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

On 7 August 2018 at 18:15, Wheeler, Gavin <[hidden email]> 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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=2ORH%2BnLCBqCDNIwIrs7%2FkcdPZhtP8hYE%2FVKrBe%2FYpDQ%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=W9QJth1ZQZiT2VlDaub2rUgsS8BnhT7Ps5STKlzqma8%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=MaRqgu7Rz8TwUvwQD%2FgIfm6bPje3spWfzDwwA%2BIQ5rA%3D&amp;reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fissues%2F17701&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=eB9j5AGT7EW1TPeGXHxIyvstvLIjk8NlscleVeOPFJk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=LyXA5Iv76X0qxQKYT1ts6%2Fvtc%2F2v%2BEa9g778QoL6%2BdI%3D&amp;reserved=0
--

Powered by https://emea01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=%2BUZyhXV9EXuLreYKa2Kx9yAnlzN9X5%2Fpw8%2FeV%2BUrCoE%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=L2gB6A4DMwOI%2BwD%2FK2lwDRQf%2BaHJ4K9gi52cYRG2fSk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Tjljc0Fic6aB7lm2Idu0TOj%2B2MAT8iGNBESYsJ0rqR4%3D&amp;reserved=0
CMake Consulting: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=jeQYQWP0dYxBfc6vF7gSllG3k%2BDxmSjufD8h58SWOkA%3D&amp;reserved=0
CMake Training Courses: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=JmQKOS6nZLEMKNi%2BS02znt9SX1fEDT9hBNfMJm89Lt0%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=01SHgapkca41kiv%2FRNuTM4DGl0rljDn6Vc1a70ZSSKg%3D&amp;reserved=0

Follow this link to subscribe/unsubscribe:
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcmake.org%2Fmailman%2Flistinfo%2Fcmake&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Q9Nrpc%2FA52FFCvo%2B3JCU5XWBWMFqbtiq6OvG2Oc3pvA%3D&amp;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/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake



--

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: Fwd: Boost + CMake + Windows + Sanity -> Possible?

Roger Leigh
On 08/08/18 12:39, Chris Wilson wrote:
> 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.

Portable build and configure commands can be found here:
https://github.com/ome/ome-cmake-superbuild/tree/master/packages/boost

There are plenty of other examples as well if you have a search around.

Regards,
Roger
--

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: Boost + CMake + Windows + Sanity -> Possible?

CMake mailing list
In reply to this post by Wheeler, Gavin

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: [hidden email] <[hidden email]> On Behalf Of Chris Wilson
Sent: 08 August 2018 12:29
To: Wheeler, Gavin <[hidden email]>
Cc: [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

 

Hi all,

 

I solved this problem (or a very similar one) by using a CMake superbuild 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_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 <[hidden email]> 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:[hidden email]] On Behalf Of Mateusz Loskot
Sent: 07 August 2018 17:34
To: [hidden email]
Subject: Re: [CMake] Boost + CMake + Windows + Sanity -> Possible?

On 7 August 2018 at 18:15, Wheeler, Gavin <[hidden email]> 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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=2ORH%2BnLCBqCDNIwIrs7%2FkcdPZhtP8hYE%2FVKrBe%2FYpDQ%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=W9QJth1ZQZiT2VlDaub2rUgsS8BnhT7Ps5STKlzqma8%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=MaRqgu7Rz8TwUvwQD%2FgIfm6bPje3spWfzDwwA%2BIQ5rA%3D&amp;reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.kitware.com%2Fcmake%2Fcmake%2Fissues%2F17701&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=eB9j5AGT7EW1TPeGXHxIyvstvLIjk8NlscleVeOPFJk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=LyXA5Iv76X0qxQKYT1ts6%2Fvtc%2F2v%2BEa9g778QoL6%2BdI%3D&amp;reserved=0
--

Powered by https://emea01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=%2BUZyhXV9EXuLreYKa2Kx9yAnlzN9X5%2Fpw8%2FeV%2BUrCoE%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=L2gB6A4DMwOI%2BwD%2FK2lwDRQf%2BaHJ4K9gi52cYRG2fSk%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Tjljc0Fic6aB7lm2Idu0TOj%2B2MAT8iGNBESYsJ0rqR4%3D&amp;reserved=0
CMake Consulting: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Fconsulting.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=jeQYQWP0dYxBfc6vF7gSllG3k%2BDxmSjufD8h58SWOkA%3D&amp;reserved=0
CMake Training Courses: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcmake.org%2Fcmake%2Fhelp%2Ftraining.html&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=JmQKOS6nZLEMKNi%2BS02znt9SX1fEDT9hBNfMJm89Lt0%3D&amp;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&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=01SHgapkca41kiv%2FRNuTM4DGl0rljDn6Vc1a70ZSSKg%3D&amp;reserved=0

Follow this link to subscribe/unsubscribe:
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcmake.org%2Fmailman%2Flistinfo%2Fcmake&amp;data=01%7C01%7Cgavin.wheeler%40kcl.ac.uk%7Cf685ba542e7849713baa08d5fc83b215%7C8370cf1416f34c16b83c724071654356%7C0&amp;sdata=Q9Nrpc%2FA52FFCvo%2B3JCU5XWBWMFqbtiq6OvG2Oc3pvA%3D&amp;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/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

 


--

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