Skip to content

Commit

Permalink
Merge pull request #389 from AlexanderRichert-NOAA/proj_gtest_fix
Browse files Browse the repository at this point in the history
Fix test settings for proj (no googletest)
  • Loading branch information
AlexanderRichert-NOAA authored Jan 10, 2024
2 parents cc9780c + 23405ea commit d003817
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import spack.cmd.common.arguments
import spack.cmd.modules
from spack.extensions.stack.meta_modules import setup_meta_modules

description = "Create meta-modules"
Expand Down
10 changes: 10 additions & 0 deletions var/spack/repos/builtin/packages/proj/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -137,6 +140,13 @@ def cmake_args(self):
]
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


Expand Down
12 changes: 12 additions & 0 deletions var/spack/repos/builtin/packages/proj/proj.cmakelists.5.0.patch
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions var/spack/repos/builtin/packages/proj/proj.cmakelists.5.1.patch
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d003817

Please sign in to comment.