Skip to content

Commit

Permalink
cgns: fix linking against HDF5
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed May 26, 2024
1 parent 88bcd0e commit 0be1028
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions recipes/cgns/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def _patch_sources(self):
else:
replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"),
"set(install_targets ${install_targets} cgns_shared)", "")
# Fix fragile linking against HDF5 libs
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
'message (STATUS "HDF5 C libs:',
('link_libraries(HDF5::HDF5)\n'
'message (STATUS "HDF5 C libs:'))

def build(self):
self._patch_sources()
Expand All @@ -122,7 +127,6 @@ def package_info(self):
if self.options.shared:
self.cpp_info.components["cgns_shared"].set_property("cmake_target_name", "CGNS::cgns_shared")
self.cpp_info.components["cgns_shared"].libs = ["cgnsdll" if self.settings.os == "Windows" else "cgns"]
self.cpp_info.components["cgns_shared"].libdirs = ["lib"]
if self.options.with_hdf5:
self.cpp_info.components["cgns_shared"].requires = ["hdf5::hdf5"]
if self.settings.os == "Windows":
Expand All @@ -131,7 +135,6 @@ def package_info(self):
else:
self.cpp_info.components["cgns_static"].set_property("cmake_target_name", "CGNS::cgns_static")
self.cpp_info.components["cgns_static"].libs = ["cgns"]
self.cpp_info.components["cgns_static"].libdirs = ["lib"]
if self.options.with_hdf5:
self.cpp_info.components["cgns_static"].requires = ["hdf5::hdf5"]

Expand Down

0 comments on commit 0be1028

Please sign in to comment.