Change path to CMakeLists.txt to be relative to root, not pwd (#4420)

* Change path to CMakeLists.txt to be relative to root, not pwd

* Changes requested during code review

* Revert back to old naming of root_cmakelists_dir
* Make relative directory more clear in docs

* Revert change causing build_type AttributeError

* Fix forgotten abs_path var

* Update CLHEP with new relative path

* Update more packages with new root_cmakelists_dir syntax
This commit is contained in:
Adam J. Stewart
2017-07-18 11:58:19 -05:00
committed by becker33
parent 5a1ee22575
commit 1215c3b20c
9 changed files with 20 additions and 23 deletions

View File

@@ -24,6 +24,7 @@
##############################################################################
import inspect
import os
import platform
import spack.build_environment
@@ -84,9 +85,12 @@ def build_type(self):
@property
def root_cmakelists_dir(self):
"""Returns the location of the root CMakeLists.txt
"""The relative path to the directory containing CMakeLists.txt
:return: directory containing the root CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
return self.stage.source_path
@@ -143,8 +147,9 @@ def cmake_args(self):
def cmake(self, spec, prefix):
"""Runs ``cmake`` in the build directory"""
options = [self.root_cmakelists_dir] + self.std_cmake_args + \
self.cmake_args()
options = [os.path.abspath(self.root_cmakelists_dir)]
options += self.std_cmake_args
options += self.cmake_args()
with working_dir(self.build_directory, create=True):
inspect.getmodule(self).cmake(*options)