[CMake] Boost's CMAKE approach and the BUILD_INTERFACE generator expression
Wesley Smith
wesley.hoke at gmail.com
Fri Oct 27 15:22:17 EDT 2017
Boost's CMAKE page (http://bcm.readthedocs.io/en/latest/src/Building.html)
says:
So this will build the library named boost_filesystem, however, we need to
supply the dependencies to boost_filesystem and add the include
directories. To add the include directory we use
target_include_directories. For this, we tell cmake to use local include
directory, but since this is only valid during build and not after
installation, we use the BUILD_INTERFACE generator expression so that cmake
will only use it during build and not installation:
target_include_directories(boost_filesystem PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
Is is necessary to use a BUILD_INTERFACE here? Couldn't you use
PUBLIC/PRIVATE/INTERFACE to achieve the same effect? What are the use
cases over for BUILD_INTERFACE that setting include dirs as
PUBLIC/PRIVATE/INTERFACE doesn't cover?
thanks,
wes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171027/bd8f0496/attachment.html>
More information about the CMake
mailing list