[cmake-developers] Namespaces

Ben Boeckel ben.boeckel at kitware.com
Thu Jan 28 15:46:10 EST 2016


On Thu, Jan 28, 2016 at 21:32:17 +0100, Pau Garcia i Quiles wrote:
> Unfortunately, using INTERNAL cache variables requires me to modify the
> third-party library, which is exactly what I do not want to do.

How so?

    set(THIRD_PARTY_FLAG MY_VALUE CACHE INTERNAL "Setting for ${parent_project}")
    add_subdirectory(thirdparty)

> I want to be able to drop the third-party in a folder,
> add_subdirectory and form then on, use it.

You really should mangle the symbols in the library if you're also
distributing libraries yourself. If it's an application, you're fine,
but not mangling symbols means you need to install the headers for that
project properly and also the library file itself should be installed
under a mangled name unless it never intends to live under /usr beside
other system software (look at how VTK mangles its third party
libraries to play nice with other tools which might have *their* own
zlib and friends).

--Ben


More information about the cmake-developers mailing list