kde-cmake: Add CMAKE_{MODULE,PREFIX}_PATH consistently.

Prior to this change, CMAKE_PREFIX_PATH was consistently set (which is
preferred for most find_package() calls) but CMAKE_MODULE_PATH was only
set for Qt5 (if Qt had a different prefix than the module being
installed).

This could lead to situations where "simplified" find_package() calls
would use "Module" mode (using CMAKE_MODULE_PATH) and end up falling
back to a search of system directories. This could result in finding the
wrong module if the module being searched for was installed on the
system.
wilder^2
Michael Pyne 8 years ago
parent 9d977859e2
commit 4a875d8d78
  1. 4
      modules/ksb/BuildSystem/KDE4.pm

@ -34,13 +34,17 @@ sub prepareModuleBuildEnvironment
# Avoid moving /usr up in env vars
if ($prefix ne '/usr') {
# Find the normal CMake "config" mode files for find_package()
$ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $prefix);
# Try to ensure that older "module" mode find_package() calls also point to right directory
$ctx->prependEnvironmentValue('CMAKE_MODULE_PATH', "$prefix/lib64/cmake:$prefix/lib/cmake");
$ctx->prependEnvironmentValue('XDG_DATA_DIRS', "$prefix/share");
}
my $qtdir = $module->getOption('qtdir');
if ($qtdir && $qtdir ne $prefix) {
# Ensure we can find Qt5's own CMake modules
$ctx->prependEnvironmentValue('CMAKE_PREFIX_PATH', $qtdir);
$ctx->prependEnvironmentValue('CMAKE_MODULE_PATH', "$qtdir/lib/cmake");
}
}

Loading…
Cancel
Save