From ea5c8fc32e7a792782d6bc63aeafce5c324ca409 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Dec 15 2021 21:21:47 +0000 Subject: Preserve CC/CXX/FC/RC set by ENV if set in cmake toolchain files --- diff --git a/mingw-filesystem.spec b/mingw-filesystem.spec index e6d83c4..dbab8b9 100644 --- a/mingw-filesystem.spec +++ b/mingw-filesystem.spec @@ -6,7 +6,7 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) Name: mingw-filesystem -Version: 125 +Version: 126 Release: 1%{?dist} Summary: MinGW cross compiler base filesystem and environment @@ -358,6 +358,9 @@ echo ".so man1/pkgconf.1" > %{buildroot}%{_mandir}/man1/x86_64-w64-mingw32-pkg-c %changelog +* Wed Dec 15 2021 Sandro Mani - 126-1 +- Preserve CC/CXX/FC/RC set by ENV if set in cmake toolchain files + * Sat Nov 20 2021 Sandro Mani - 125-1 - Fix up debug dirs ownership diff --git a/toolchain-mingw32.cmake b/toolchain-mingw32.cmake index e8e321a..27a45df 100644 --- a/toolchain-mingw32.cmake +++ b/toolchain-mingw32.cmake @@ -2,8 +2,15 @@ SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_PROCESSOR x86) # specify the cross compiler -SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) -SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) +IF(NOT $ENV{CC}) + SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc) +ENDIF() +IF(NOT $ENV{CXX}) + SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++) +ENDIF() +IF(NOT $ENV{FC}) + SET(CMAKE_Fortran_COMPILER /usr/bin/i686-w64-mingw32-gfortran) +ENDIF() # where is the target environment SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32/sys-root/mingw) @@ -18,10 +25,11 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET(QT_BINARY_DIR /usr/i686-w64-mingw32/bin /usr/bin) # set the resource compiler (RHBZ #652435) -SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres) +IF(NOT $ENV{RC}) + SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres) +ENDIF() # These are needed for compiling lapack (RHBZ #753906) -SET(CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran) SET(CMAKE_AR:FILEPATH /usr/bin/i686-w64-mingw32-ar) SET(CMAKE_RANLIB:FILEPATH /usr/bin/i686-w64-mingw32-ranlib) diff --git a/toolchain-mingw64.cmake b/toolchain-mingw64.cmake index 0ae6a74..60fcebe 100644 --- a/toolchain-mingw64.cmake +++ b/toolchain-mingw64.cmake @@ -2,8 +2,15 @@ SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_PROCESSOR x86_64) # specify the cross compiler -SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) -SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +IF(NOT $ENV{CC}) + SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc) +ENDIF() +IF(NOT $ENV{CXX}) + SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++) +ENDIF() +IF(NOT $ENV{FC}) + SET(CMAKE_Fortran_COMPILER /usr/bin/x86_64-w64-mingw32-gfortran) +ENDIF() # where is the target environment SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32/sys-root/mingw) @@ -18,10 +25,11 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET(QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin) # set the resource compiler (RHBZ #652435) -SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres) +IF(NOT $ENV{RC}) + SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres) +ENDIF() # These are needed for compiling lapack (RHBZ #753906) -SET(CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) SET(CMAKE_AR:FILEPATH /usr/bin/x86_64-w64-mingw32-ar) SET(CMAKE_RANLIB:FILEPATH /usr/bin/x86_64-w64-mingw32-ranlib)