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
This commit is contained in:
parent
3e68aa0b2f
commit
013f0d3a13
@ -85,6 +85,9 @@ class Proj(CMakePackage, AutotoolsPackage):
|
|||||||
when="@7:7.2.1",
|
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
|
# https://proj.org/install.html#build-requirements
|
||||||
with when("build_system=cmake"):
|
with when("build_system=cmake"):
|
||||||
depends_on("cmake@3.9:", when="@6:", type="build")
|
depends_on("cmake@3.9:", when="@6:", type="build")
|
||||||
@ -137,6 +140,13 @@ def cmake_args(self):
|
|||||||
]
|
]
|
||||||
if self.spec.satisfies("@6:") and self.pkg.run_tests:
|
if self.spec.satisfies("@6:") and self.pkg.run_tests:
|
||||||
args.append(self.define("USE_EXTERNAL_GTEST", True))
|
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
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
@ -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)
|
Loading…
Reference in New Issue
Block a user