cgns: Add -fPIC to Fortan/C compilation flags (#39700)

* cgns: Add -fPIC to Fortan/C compilation flags
  This should fix #39699
* cgns: Add -fPIC compilation flags when +fortran
  Incorporating suggestions of @aumuell with addition of making +pic required when +fortran
This commit is contained in:
Tom Payerle 2023-09-06 19:18:07 -04:00 committed by GitHub
parent 5bc5139552
commit 743a93902d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,7 @@ class Cgns(CMakePackage):
variant("legacy", default=False, description="Enable legacy options")
variant("mem_debug", default=False, description="Enable memory debugging option")
variant("tools", default=False, description="Enable CGNS tools")
variant("pic", default=False, description="Produce position-independent code")
depends_on("cmake@3.12:", when="@4.3:", type="build")
depends_on("cmake@3.8:", when="@4.2:", type="build")
@ -62,6 +63,8 @@ class Cgns(CMakePackage):
depends_on("libxmu", when="+tools")
depends_on("libsm", when="+tools")
conflicts("~pic", when="+fortran", msg="+pic required when +fortran")
# patch for error undefined reference to `matherr, see
# https://bugs.gentoo.org/662210
patch("no-matherr.patch", when="@:3.3.1 +tools")
@ -83,6 +86,7 @@ def cmake_args(self):
self.define_from_variant("CGNS_ENABLE_BASE_SCOPE", "base_scope"),
self.define_from_variant("CGNS_ENABLE_LEGACY", "legacy"),
self.define_from_variant("CGNS_ENABLE_MEM_DEBUG", "mem_debug"),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
]
)