GithubHelp home page GithubHelp logo

Comments (7)

Orphis avatar Orphis commented on July 17, 2024

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.

rcdailey avatar rcdailey commented on July 17, 2024

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.

Orphis avatar Orphis commented on July 17, 2024

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.

rcdailey avatar rcdailey commented on July 17, 2024

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.

Orphis avatar Orphis commented on July 17, 2024

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.

Orphis avatar Orphis commented on July 17, 2024

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.

rcdailey avatar rcdailey commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.