Opened 9 months ago

Last modified 9 months ago

#64757 new request

How to enable Cmake to find Boost?

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: powerpc Cc:
Port: cmake

Description

I am trying to make a new port and it requires Boost. Outside of Macports I just use this, and it works: -DBoost_INCLUDE_DIR=/opt/local/libexec/boost/1.76/include.

However doing the same in a local port file fails:

CMake Error at /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: system filesystem program_options date_time)
  (found version "1.76.0")
Call Stack (most recent call first):
  /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/local/share/cmake-3.22/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  CMakeLists.txt:207 (find_package)

I started with:

configure.args-append  -DBOOST_INCLUDE_DIR=/opt/local/libexec/boost/1.76/include

That failed to change anything, and ended with the following, which had zero effect again (flags are passed, but to no effect):

configure.env-append	BOOST_ROOT=/opt/local/libexec/boost/1.76 \
						BOOST_INCLUDE_DIR=/opt/local/libexec/boost/1.76/include

configure.args-append   -DBOOST_ROOT=/opt/local/libexec/boost/1.76 \
                        -DBOOST_INCLUDE_DIR=/opt/local/libexec/boost/1.76/include \
                        -DBOOST_LIB_DIR=/opt/local/libexec/boost/1.76/include


Change History (4)

comment:1 Changed 9 months ago by reneeotten (Renee Otten)

Are you using the boost PortGroup already, if not I would to that first as there is some code in there already to setup things correctly.

Last edited 9 months ago by reneeotten (Renee Otten) (previous) (diff)

comment:2 in reply to:  1 Changed 9 months ago by barracuda156

Replying to reneeotten:

Are you using the boost PortGroup already, if not I would to that first as there is some code in there already to setup things correctly.

Great, thank you and @kencu, that indeed helped.

comment:3 in reply to:  1 ; Changed 9 months ago by barracuda156

Replying to reneeotten:

Are you using the boost PortGroup already, if not I would to that first as there is some code in there already to setup things correctly.

As an odd effect on 10.5.8, while I specifically have boost176 in port file (and boost176 is already built even), when I try install my port, Macports insists on installing boost171 instead.

This did not occur on 10.6 PPC, where boost176 was used, as supposed.

comment:4 in reply to:  3 Changed 9 months ago by reneeotten (Renee Otten)

Replying to barracuda156:

Replying to reneeotten:

Are you using the boost PortGroup already, if not I would to that first as there is some code in there already to setup things correctly.

As an odd effect on 10.5.8, while I specifically have boost176 in port file (and boost176 is already built even), when I try install my port, Macports insists on installing boost171 instead.

This did not occur on 10.6 PPC, where boost176 was used, as supposed.

not all that surprising if you take a look at the code in the boost PG:

proc boost::default_version {} {
    global os.platform os.major
    # Pin version on Darwin9 and older to pre-c++11 version (1.71)
    if { ${os.platform} eq "darwin" && ${os.major} <= 9 } {
        return 1.71
    } else {
        return 1.76
    }
}
Note: See TracTickets for help on using tickets.