ports/devel/cmake/files/patch-Modules_FindBLAS.cmake
Adriaan de Groot 29caeeebb5 Update CMake to 3.11.0. Thanks to antoine@ for the exp-run.
In the run-up to this commit, many other ports were pre-emptively fixed.
The only issue still known is math/kig, which had a build failure in
the exp-run, but which isn't reproducible across multiple 11.1 {i386,amd64}
machines and poudriere builds. We've decided to forge ahead.

The new CMake version:
 - drops FreeBSD patches that have been incorporated upstream,
 - re-shuffles patches to FindQt4, since upstream has made some changes
   which break FindQt4 in new ways on FreeBSD (while fixing the old ones),
 - has new patches to make OpenMP and BLAS findable on FreeBSD,
 - drops ports libarchive in favor of the version in base, to avoid
   overlinking for the pkg(8) support in CPack (this makes portlint
   complain, and we have decided to ignore it).

PR:		227372 226959 223678
Approved by:	tcberner (mentor)
Differential Revision:	https://reviews.freebsd.org/D14506
2018-04-15 21:43:57 +00:00

34 lines
1.6 KiB
CMake

When finding BLAS, we may need to explicitly add gcc_s from the correct
gcc directory to the libraries linked in while testing for BLAS functions.
Check for the necessity via some ldd trickery. PR 226959.
--- Modules/FindBLAS.cmake.orig 2018-04-06 14:25:24.441628000 +0200
+++ Modules/FindBLAS.cmake 2018-04-06 15:24:27.515872000 +0200
@@ -162,6 +162,27 @@
else()
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
endif()
+ if (NOT ${_prefix}${_combined_name}_WORKS)
+ # On FreeBSD, we may need to link to gcc_s in a special way
+ execute_process(
+ COMMAND /usr/bin/ldd ${${LIBRARIES}}
+ COMMAND /usr/bin/grep gcc_s
+ COMMAND /usr/bin/cut -w -f 4
+ RESULT_VARIABLE _found_needed
+ OUTPUT_VARIABLE _output_needed
+ )
+# message("DEBUG: found=${_found_needed} output=${_output_needed}")
+ if (_found_needed EQUAL "0" AND _output_needed MATCHES "libgcc_s")
+ set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_output_needed} ${_thread})
+ message(STATUS "Re-trying ${LIBRARIES} search with gcc_s")
+ if (CMAKE_Fortran_COMPILER_LOADED)
+ check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS2)
+ else()
+ check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS2)
+ endif()
+ set(${_prefix}${_combined_name}_WORKS ${${_prefix}${_combined_name}_WORKS2})
+ endif()
+ endif()
set(CMAKE_REQUIRED_LIBRARIES)
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})