[cmake-developers] Make CMAKE_SHARED_MODULE_PREFIX empty by default on UNIX ?

Brad King brad.king at kitware.com
Thu Dec 13 08:10:28 EST 2012


On 12/13/2012 05:15 AM, Alexander Neundorf wrote:
> There was a request on the KDE buildsystem list to make this the default 
> behaviour of cmake:
> http://thread.gmane.org/gmane.comp.kde.devel.buildsystem/7570
[snip]
> AFAIK, CMakeSystemSpecificInformation.cmake is executed very early during a 
> cmake run, at least if there is no project() call in the CMakeLists.txt.
> This makes it hard to use a policy for changing this behaviour, right ?

Furthermore the policy setting should have per-target granularity based
on its value when each target is created.  We can't have a single policy
control the entire build tree's default.

Instead, when the policy is NEW, *ignore* CMAKE_SHARED_MODULE_PREFIX
and always use an empty default prefix for MODULE libraries.  Projects
can always set the PREFIX property.  Optionally a new variable can be
introduced to use with cmTarget's SetPropertyDefault to get a default
value for the property.

If the explicit property is not set such that the logic reaches the
point of needing the old variable value, then check the policy value
recorded at the target's creation.  If it is NEW, use "".  If it is
OLD, use the variable.  If it is not set, use the variable and warn
if its value is not "".

-Brad



More information about the cmake-developers mailing list