Help needed finding Boost build

Michael Hill mdhillca at gmail.com
Wed Apr 15 18:31:13 UTC 2020


On Wed, Apr 15, 2020 at 8:19 AM Pander <pander at users.sourceforge.net> wrote:

> I'm able to build Boost, however, building of our application is not
> finding it. Could somebody help with this please?

I don't know if this will tell you anything, but Boost is built as
part of the FreeCAD Flatpak:

https://github.com/flathub/org.freecadweb.FreeCAD/blob/master/org.freecadweb.FreeCAD.yaml

For Python3 I use a YAML version of this (I had to add an environment variable):

https://github.com/boostorg/boost/issues/334


I'm not clear on FreeCAD's (working) detection mechanism, but the
FreeCAD source has a src/3rdParty/boost.CMakeLists.txt that looks like
this:

add_definitions(-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

aux_source_directory(libs/program_options/src BOOST_PROGRAM_OPTIONS_SRCS)
add_library(boost_program_options ${BOOST_PROGRAM_OPTIONS_SRCS})

aux_source_directory(libs/regex/src BOOST_REGEX_SRCS)
add_library(boost_regex ${BOOST_REGEX_SRCS})

aux_source_directory(libs/signals/src BOOST_SIGNALS_SRCS)
add_library(boost_signals ${BOOST_SIGNALS_SRCS})

aux_source_directory(libs/system/src BOOST_SYSTEM_SRCS)
add_library(boost_system ${BOOST_SYSTEM_SRCS})

if(BUILD_SHARED_LIBS)
install(TARGETS boost_program_options boost_signals DESTINATION lib)
endif(BUILD_SHARED_LIBS)


and a cMake/FreeCAD_Helpers/SetupBoost.cmake that looks like this:

macro(SetupBoost)
# -------------------------------- Boost --------------------------------

    set(_boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS})

    set (BOOST_COMPONENTS filesystem program_options regex system thread)
    find_package(Boost ${BOOST_MIN_VERSION}
        COMPONENTS ${BOOST_COMPONENTS} REQUIRED)

    if(UNIX AND NOT APPLE)
        # Boost.Thread 1.67+ headers reference pthread_condattr_*
        list(APPEND Boost_LIBRARIES pthread)
    endif()

    if(NOT Boost_FOUND)
        set (NO_BOOST_COMPONENTS)
        foreach (comp ${BOOST_COMPONENTS})
            string(TOUPPER ${comp} uppercomp)
            if (NOT Boost_${uppercomp}_FOUND)
                list(APPEND NO_BOOST_COMPONENTS ${comp})
            endif()
        endforeach()
        message(FATAL_ERROR "=============================================\n"
                            "Required components:\n"
                            " ${BOOST_COMPONENTS}\n"
                            "Not found, install the components:\n"
                            " ${NO_BOOST_COMPONENTS}\n"
                            "=============================================\n")
    endif(NOT Boost_FOUND)

endmacro(SetupBoost)


There's also a header file called boost_any_1_55.hpp .

Mike


More information about the Flatpak mailing list