set CMAKE_PREFIX_PATH for cmake packages (#5364)

* cmake: set CMAKE_PREFIX_PATH

* cmake: use build/link immediate dependencies to construct CMAKE_PREFIX_PATH
This commit is contained in:
Denis Davydov 2017-09-16 22:14:03 +02:00 committed by becker33
parent 7cec47aacd
commit f710a520e5

View File

@ -145,6 +145,11 @@ def _std_args(pkg):
args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=FALSE')
rpaths = ':'.join(spack.build_environment.get_rpaths(pkg))
args.append('-DCMAKE_INSTALL_RPATH:STRING={0}'.format(rpaths))
# CMake's find_package() looks in CMAKE_PREFIX_PATH first, help CMake
# to find immediate link dependencies in right places:
deps = [d.prefix for d in
pkg.spec.dependencies(deptype=('build', 'link'))]
args.append('-DCMAKE_PREFIX_PATH:STRING={0}'.format(';'.join(deps)))
return args
@property