summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cortial <101571984+jcortial-safran@users.noreply.github.com>2023-12-06 16:32:39 +0100
committerGitHub <noreply@github.com>2023-12-06 09:32:39 -0600
commit013f0d3a13b4996fbfac17d0d02999ef0c248ffd (patch)
tree803fa0d69d23dac8387f3397971ae266a50db814
parent3e68aa0b2f2c43f6ada947e33d03054570b242cd (diff)
downloadspack-013f0d3a13b4996fbfac17d0d02999ef0c248ffd.tar.gz
spack-013f0d3a13b4996fbfac17d0d02999ef0c248ffd.tar.bz2
spack-013f0d3a13b4996fbfac17d0d02999ef0c248ffd.tar.xz
spack-013f0d3a13b4996fbfac17d0d02999ef0c248ffd.zip
Only build tests for proj package if required (#41065)
* Only build tests for proj package if required Even if tests are not explictly required to be built, proj build them anyway and tries to download Google Test. * proj: fix name of test activation flag * proj: Always set test activation flag * proj: Patch test activation logic for versions 5.x
-rw-r--r--var/spack/repos/builtin/packages/proj/package.py10
-rw-r--r--var/spack/repos/builtin/packages/proj/proj.cmakelists.5.0.patch12
-rw-r--r--var/spack/repos/builtin/packages/proj/proj.cmakelists.5.1.patch12
3 files changed, 34 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/proj/package.py b/var/spack/repos/builtin/packages/proj/package.py
index a49adf19b8..01107a698f 100644
--- a/var/spack/repos/builtin/packages/proj/package.py
+++ b/var/spack/repos/builtin/packages/proj/package.py
@@ -85,6 +85,9 @@ class Proj(CMakePackage, AutotoolsPackage):
when="@7:7.2.1",
)
+ patch("proj.cmakelists.5.0.patch", when="@5.0")
+ patch("proj.cmakelists.5.1.patch", when="@5.1:5.2")
+
# https://proj.org/install.html#build-requirements
with when("build_system=cmake"):
depends_on("cmake@3.9:", when="@6:", type="build")
@@ -137,6 +140,13 @@ class CMakeBuilder(BaseBuilder, cmake.CMakeBuilder):
]
if self.spec.satisfies("@6:") and self.pkg.run_tests:
args.append(self.define("USE_EXTERNAL_GTEST", True))
+ if self.spec.satisfies("@7:"):
+ test_flag = "BUILD_TESTING"
+ elif self.spec.satisfies("@5.1:"):
+ test_flag = "PROJ_TESTS"
+ else:
+ test_flag = "PROJ4_TESTS"
+ args.append(self.define(test_flag, self.pkg.run_tests))
return args
diff --git a/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.0.patch b/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.0.patch
new file mode 100644
index 0000000000..02302bce9d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.0.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -149,5 +149,6 @@ add_subdirectory(nad)
+ add_subdirectory(src)
+ add_subdirectory(man)
+ add_subdirectory(cmake)
+-add_subdirectory(test)
+-
++if(PROJ4_TESTS)
++ add_subdirectory(test)
++endif(PROJ4_TESTS)
diff --git a/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.1.patch b/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.1.patch
new file mode 100644
index 0000000000..fb4ad9b052
--- /dev/null
+++ b/var/spack/repos/builtin/packages/proj/proj.cmakelists.5.1.patch
@@ -0,0 +1,12 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -159,5 +159,6 @@ add_subdirectory(nad)
+ add_subdirectory(src)
+ add_subdirectory(man)
+ add_subdirectory(cmake)
+-add_subdirectory(test)
+-
++if(PROJ_TESTS)
++ add_subdirectory(test)
++endif(PROJ_TESTS)