Boost logo

Boost :

Subject: Re: [boost] Switch to CMake -- Analysis
From: Roger Leigh (rleigh_at_[hidden])
Date: 2017-07-21 20:14:19


On 21/07/17 20:53, Artyom Beilis via Boost wrote:
[...]
> And this is one of the most basic and trivial feature that exists in every
> real world build system.
>
> And now take a look on this code:
>
> https://github.com/artyom-beilis/cppcms/blob/master/booster/CMakeLists.txt#L124
>
> Lines 124-145 this is how I search ICU for Boost.Locale

Note that you can further simplify this to a single line:

   find_package(ICU COMPONENTS uc data i18n)

and then use the imported targets ICU::uc, ICU::data and ICU::i18n to
link with. Handles all the debug postfixes, alternative library names
on Windows (dt/data, in/i18n) etc. It's basically what you're doing,
but a bit more comprehensive and flexible (by using the imported
targets, you allow for /export/ of the target configuration for use by
end users and downstream components).

This requires FindICU.cmake, which is provided in newer CMake releases.
But it's absolutely possible to copy this into your own project to
support older CMake releases (I do this myself). See
https://cmake.org/cmake/help/v3.9/module/FindICU.html for further details.

Regards,
Roger


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