Cmake: improve ncurses detection (#25776)

* Optionally enable ccmake in cmake

Renames ncurses variant to `ccmake` since that's how users know it, and
explicitly enable/disable `BUILD_CursesDialog`.

* Make cmake locate its dependencies with CMAKE_PREFIX_PATH, and set rpath flags too

* Undo variant name & defaults change
This commit is contained in:
Harmen Stoppels 2021-09-08 13:56:00 +02:00 committed by GitHub
parent 47b16b39a3
commit c33382b607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,8 @@
import re
import spack.build_environment
class Cmake(Package):
"""A cross-platform, open-source build system. CMake is a family of
@ -277,6 +279,17 @@ def bootstrap_args(self):
if '+ownlibs' in spec:
args.append('-DCMAKE_USE_OPENSSL=%s' % str('+openssl' in spec))
args.append('-DBUILD_CursesDialog=%s' % str('+ncurses' in spec))
# Make CMake find its own dependencies.
rpaths = spack.build_environment.get_rpaths(self)
prefixes = spack.build_environment.get_cmake_prefix_path(self)
args.extend([
'-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF',
'-DCMAKE_INSTALL_RPATH={0}'.format(";".join(str(v) for v in rpaths)),
'-DCMAKE_PREFIX_PATH={0}'.format(";".join(str(v) for v in prefixes))
])
return args
def bootstrap(self, spec, prefix):