Boost logo

Boost :

Subject: Re: [boost] Cmake
From: P F (pfultz2_at_[hidden])
Date: 2017-06-25 00:14:13


> On Jun 24, 2017, at 4:19 PM, Peter Dimov via Boost <boost_at_[hidden]> wrote:
>
> P F wrote:
>> No, you just do `include` instead of `add_subdirectory`, but it doesn’t require installation.
>
> I'm not sure I understand. find_package(BCM) is unconditional in CMakeLists.txt, right?
>
> https://github.com/pfultz2/boost-cmake-demo/blob/bcm-demo/libs/system/CMakeLists.txt#L5

Yes, but in the superproject I exclude it:

macro(find_package NAME)
  if(NOT "${NAME}" MATCHES "^boost_.*$" AND NOT "${NAME}" STREQUAL BCM)
    _find_package(${ARGV})
  endif()
endmacro()

Alternatively, in the superproject I could append the cmake prefix path:

list(APPEND CMAKE_PREFIX_PATH bcm)

Which would make `find_package(BCM)` work in the subprojects, and the include would not be needed. This might be a better approach.

>
> What 'include` do you do and where?

Thats the `include(bcm/share/bcm/cmake/BCMConfig.cmake)`, here:

https://github.com/pfultz2/boost-cmake-demo/blob/bcm-demo/CMakeLists.txt#L11

>
> Unrelated, why do you need `include(GNUInstallDirs)` here:
>
> https://github.com/pfultz2/boost-cmake-demo/blob/bcm-demo/bcm/share/bcm/cmake/BCMPackage.cmake#L2
>
> ?

Its not needed. I think originally I was going to use that module for the install directories.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk