Comments (7)
Hi Robert,
From experience, rebuilding Boost doesn't take much time if you only build your top level targets, like 10s total for my project.
Building the whole solution will probably take more time because of some slow to build libraries. If you can't get away from "build whole solution", I may add some way to filter which Boost library will be built, so you only get what you use, and would hopefully be a small enough subset.
As for ExternalProject_Add, I believe this is a hack and shouldn't be used. It doesn't forward all the build flags properly to the subproject from the main project and is error prone. I don't believe you need to have install targets if you insist on using it though. But with install targets and export module it would certainly be easier.
Would you be alright testing if the first solution is satisfactory? Without changing the code, you could just set the variable BOOST_LIBS as a cache variable with the libraries you want before doing your add_subdirectory()
call.
from boost-cmake.
Well the big downside to ExternalProject (for me, at least) is that it builds at runtime and you can't set up dependencies. I guess I'll give your suggestion a shot (using BOOST_LIBS
).
from boost-cmake.
Yes, that is indeed another problem. You could in theory setup some imported targets that depend on the external project and point to the build artifact in it, but it's just another layer of hacks...
Straightforward CMake is better.
Also, to reduce your build times, you could use the Ninja generator maybe with sccache on Windows, it will cache build artifacts and should speedup quite significantly your builds. I know with the latest Visual Studio 15.3, it will be supported directly with their CMake integration, which is quite nice. The only issue is that it changes the workflow in Visual Studio from project based to folder based, which might be a big issue sometimes.
from boost-cmake.
By the way I'm not able to override BOOST_LIBS
because it always sets the list and local variables take precedence over cache variables in CMake. I made the following change which fixes it:
if(NOT BOOST_LIBS)
set(BOOST_LIBS
# Compiled libs
atomic
chrono
container
context
coroutine
date_time
exception
fiber
filesystem
graph
iostreams
locale
log
math
mpi
graph_parallel # depends on mpi, so needs to be put after it
program_options
#python # complex module
random
regex
serialization
signals
system
unit_test_framework
thread
timer
type_erasure
wave
)
endif()
list( APPEND BOOST_LIBS
# Header only libs
header
)
Do you want a PR?
from boost-cmake.
Local variables are overriding cache variables? I didn't know that!
I'm thinking of doing it a little bit differently as I will be probably adding more header only libraries at some point (like asio, which needs a dependency on OpenSSL). I have a hacking day tomorrow planned, so I'll probably do it then :)
from boost-cmake.
Also, a problem with the code above is that if BOOST_LIBS is intentionally empty (maybe you just want header only libraries), you'll end up with the full list defined.
from boost-cmake.
Hmm yeah, true. Anyway this works for me for the moment. I'll keep this on my fork until you get a more appropriate solution in place. At the moment I don't plan to specify an empty list so non-issue for me.
from boost-cmake.
Related Issues (20)
- Cannot compile boost 1.7.6 HOT 1
- as of boost 1.76.0 regex becomes header only
- Boost_INCLUDE_DIR is not getting set
- the right way to enable/disable Boost features in main CMake script?
- Doesn't work with Windows 11 and VS 22 HOT 2
- Enable /MP for parallel builds with MSVC HOT 1
- Download fails when multiple configurations are generated in parallel HOT 6
- Clarity on README installation HOT 11
- Feature Request : checking in partial boost trees. HOT 4
- Android Issues HOT 6
- Add option to support building boost dynamic library HOT 6
- "Fetching Boost" happens every time I configure HOT 1
- Usage with find_package REQUIRED etc. HOT 1
- 403 Forbidden downloading https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 HOT 9
- Changing the BOOST_URL leads to linking error HOT 3
- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR) Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
- Can I use it to cross compile boost for ARM ?
- Store result of try compile in cache variable?
- Add tags for boost versions HOT 3
- Cross compilation issue from linux to windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boost-cmake.