summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFrédéric Simonis <simonisfrederic@gmail.com>2022-04-28 19:03:13 +0200
committerGitHub <noreply@github.com>2022-04-28 17:03:13 +0000
commit1006dd54dee37793428043ad296836d7f323c7c6 (patch)
tree5007b7682582a1f6a26bf47597ae2c4ced7817dd /lib
parentcf905ec14a9a21ddc68831a7f793e98f72f0a1a4 (diff)
downloadspack-1006dd54dee37793428043ad296836d7f323c7c6.tar.gz
spack-1006dd54dee37793428043ad296836d7f323c7c6.tar.bz2
spack-1006dd54dee37793428043ad296836d7f323c7c6.tar.xz
spack-1006dd54dee37793428043ad296836d7f323c7c6.zip
Add BUILD_TESTING to standard CMake arguments (#30374)
CTest determines whether to enable tests using the BUILD_TESTING variable. This should be used by projects to conditionally enable the compilation of tests. Spack knowns which packages have to run tests and can thus automatically define this variable.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cmake.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py
index f934947604..105e9d5ab8 100644
--- a/lib/spack/spack/build_systems/cmake.py
+++ b/lib/spack/spack/build_systems/cmake.py
@@ -176,6 +176,7 @@ class CMakePackage(PackageBase):
'-G', generator,
define('CMAKE_INSTALL_PREFIX', convert_to_posix_path(pkg.prefix)),
define('CMAKE_BUILD_TYPE', build_type),
+ define('BUILD_TESTING', pkg.run_tests),
]
# CMAKE_INTERPROCEDURAL_OPTIMIZATION only exists for CMake >= 3.9
@@ -361,6 +362,7 @@ class CMakePackage(PackageBase):
* CMAKE_INSTALL_PREFIX
* CMAKE_BUILD_TYPE
+ * BUILD_TESTING
which will be set automatically.