[CMake] External header only library (boost)

Bohr, Riley Riley.Bohr at RadiantSolutions.com
Tue Aug 14 13:28:03 EDT 2018


Hi CMake people,

I am trying to configure CMake to retrieve boost, and then run boosts bcp tool to extract a subset of boost (math/special_functions) that I need for my project. I had it working before, but now I'm not sure what went wrong.

Right now when I build, CMake is able to retrieve the boost zip archive from their website, extract it, and run bcp to extract the subset, but now when I build my project that depends on the imported boost library it is looking for .obj files.

Since boost is header only, it doesn't need to be built, so should CMake be looking for library files?

This is the contents of CMakeLists-BOOST.txt that the main CMakeLists.txt calls. The boost-bcp.py script is able to extract the subset of header files that I need, so the problem shouldn't be in there.

Any help is appreciated, thank you



include(ExternalProject)

set(BOOST_PREFIX "${CMAKE_SOURCE_DIR}/../pulsar-boost")

file(MAKE_DIRECTORY ${BOOST_PREFIX})
file(MAKE_DIRECTORY ${BOOST_PREFIX}/boost-full)
file(MAKE_DIRECTORY ${BOOST_PREFIX}/include)

ExternalProject_Add(boost
    URL https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.zip

    PATCH_COMMAND ""

    PREFIX "${BOOST_PREFIX}"

    SOURCE_DIR "${BOOST_PREFIX}/boost-full"


    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""

    TEST_COMMAND ""

    LOG_DOWNLOAD 1
    LOG_CONFIGURE 1
    LOG_INSTALL 1
)




# Additional submodules can be passed to the python script if needed
# BCP will extract each subset
ExternalProject_Add_Step(boost
    bcp
    COMMAND python boost-bcp.py math/special_functions
    DEPENDEES download
    ALWAYS 0
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    LOG 1
)

ExternalProject_Get_Property(boost install_dir)

message("boost install dir: " ${install_dir})

add_library(pulsar-boost STATIC IMPORTED)

set_property(TARGET pulsar-boost PROPERTY IMPORTED_LOCATION ${install_dir}/lib/lib-boost)

add_dependencies(pulsar-boost boost)

include_directories(${install_dir}/include)




The information contained in this communication is confidential, is intended only for the use of the recipient(s) named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180814/350768f6/attachment-0001.html>


More information about the CMake mailing list