[cmake-developers] [PATCH] Allow LIB_SUFFIX be used as find path

Brad King brad.king at kitware.com
Mon Jan 9 15:17:47 EST 2017


On 01/04/2017 05:12 PM, Christian Schmidbauer wrote:
>>   cmake ../src -DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=x32
> 
> Currently, cmake tries to detect the naming scheme for
> lib/lib32/lib64, hence making the life of a distribution with
> non-standard library folders very hard. This patch should allow a
> distribution to set the naming scheme of the lib<qual> folder to
> whatever they want (allowed should be anything, see [1]).
> 
> I don't have enough insight into cmake in order to say what would be
> the "proper" way to achieve this. I went ahead and followed the logic
> from Gentoo's portage (see [2] line 531-533) and tried to expand it
> such that you can specify any string for <qual>.

I think their use of `LIB_SUFFIX` and my proposed variable named
above are about the same except for the name.  Currently your
patch checks for a `FIND_LIBRARY_USE_CUSTOM_PATHS` global property
and uses that to decide whether to check the `LIB_SUFFIX` variable.

Instead I think it could just check for a single variable called
`CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX`, and if set use it instead
of the default lib/lib32/lib64 for the current platform.  That will
allow users and distro packagers to build projects with the custom
lib dir suffix.

-Brad



More information about the cmake-developers mailing list