|
Boost Interest : |
Subject: Re: [Boost-cmake] Building boost "with an uninstalled build" and linking to boost libs
From: Brian Davis (bitminer_at_[hidden])
Date: 2010-03-25 00:22:33
I've had good success using the Boost "in a subdirectory" recipe,
> which builds only the parts I need. This is on linux/mac with gcc and
> make, so YMMV, but I think the relevant parts of my CMake file are:
>
>
Sweet all I need to do is switch to Linux... this is now reason 10463 on my
reasons to switch OS's. :-)
> # Variables to configure how boost is built
> # If we need more libraries add them to the BUILD_PROJECTS variable
> set(BUILD_TESTS 0 CACHE INTERNAL "")
> set(ENABLE_SHARED 1 CACHE INTERNAL "")
> set(ENABLE_STATIC 1 CACHE INTERNAL "")
> <set a few more config options>
>
Above are set by default so I do not think this is a problem in my system.
> set(BUILD_PROJECTS date_time program_options filesystem system regex
> CACHE INTERNAL "")
>
I tried this set(BUILD_PROJECTS thread filesystem ... ) on Windows and ended
up with a phantom boost_filesystem project... weird ... see my post above,
but I did get thread (the first item in the list) I will verify this again.
> ...
> # Exclude boost libs from the all target, they will be built
> # as dependencies of other targets that require them.
> add_subdirectory(vendor/boost/boost EXCLUDE_FROM_ALL)
> ...
>
maybe I need to use the EXCLUDE_FROM_ALL I will try this.
> include_directories(${project_SOURCE_DIR}/vendor/boost/boost)
> ...
>
> In my subprojects' CMakeLists.txt files, I then add dependent
> libraries as required:
> target_link_libraries(target_name boost_program_options-static
> boost_regex-static)
>
>
Thanks for the target_link_libraries syntax I was wondering what to put for
this I was trying multiple variants.
-- Brian J. Davis