From bfc6c0c19d7d0823de62e11c67459c6fd74de5ce Mon Sep 17 00:00:00 2001 From: Alexander Soklev Date: Thu, 19 Dec 2024 22:11:05 +0200 Subject: [PATCH] Added find_program for CMAKE_Fortran_COMPILER on windows, if path is not set for it --- CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b7892332..b53596ac6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,13 +82,16 @@ else() NO_DEFAULT_PATH ) - # find_program(CMAKE_Fortran_COMPILER gfortran - # PATHS - # $ENV{PREFIX}/Library/bin - # $ENV{BUILD_PREFIX}/Library/bin - # $ENV{CONDA_PREFIX}/Library/bin - # NO_DEFAULT_PATH - # ) + # Try go find fortran compiler only, if nothing is set or only name is set + if ((CMAKE_Fortran_COMPILER STREQUAL "") OR (NOT CMAKE_Fortran_COMPILER IN_LIST PREFERRED_FC_COMPILERS)) + find_program(CMAKE_Fortran_COMPILER gfortran + PATHS + $ENV{PREFIX}/Library/bin + $ENV{BUILD_PREFIX}/Library/bin + $ENV{CONDA_PREFIX}/Library/bin + NO_DEFAULT_PATH + ) + endif() message(STATUS "CMAKE_AR: ${CMAKE_AR}") message(STATUS "CMAKE_RANLIB: ${CMAKE_RANLIB}")