Hello,

attached patch adds Fortran compiler to Gentoo override rules in
cmake-utils.eclass the same way C/C++ compilers are added.

This change is needed because packages which force their own
precedence of Fortran compilers or flags also exists. We hit this
issue on bug 486626 [1] for sci-libs/lapacke-reference (science
overlay): if multiple Fortran compilers are installed, e.g. pathf95
and gfortran, package prefers pathf95 — this may even broke build,
because most FCFLAGS are not compatible between this compilers

In order to fix this FC should be set from $(tc-getFC), which is
implemented in proposed patch as well as ensuring proper flags are
set.

This change was already discussed with KDE team [1] and I'm going to
commit this patch after feedback or in a week if there are no
objections.

[1] https://bugs.gentoo.org/show_bug.cgi?id=486626

Best regards,
Andrew Savchenko
--- cmake-utils.eclass.orig	2014-12-18 20:01:09.000000000 +0300
+++ cmake-utils.eclass	2015-02-11 20:54:43.307183771 +0300
@@ -462,6 +462,7 @@
 		SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
 		SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
 		SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
+		SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
 		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
 		SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)
 	_EOF_
@@ -470,6 +471,7 @@
 	cat > ${toolchain_file} <<- _EOF_
 		SET (CMAKE_C_COMPILER $(tc-getCC))
 		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
+		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
 	_EOF_
 
 	if tc-is-cross-compiler; then

Attachment: pgpHPv48kuxSP.pgp
Description: PGP signature

Reply via email to