I am trying to compile the NJOY 2016 program from Los Alamos National Laboratory on Windows Professional v10. It comes with its own CMakeLists.txt and searches for the Fortran compiler because it is designed to run on a variety of systems. I am using CMake v3.31.3. The build process needs both Python and a Fortran compiler. It finds Python with no problem. It cannot find my GNU Fortran compiler. My path is as follows:
PATH=C:\Program Files\Python313\Scripts;C:\Program Files\Python313;C:\Program Files\Microsoft MPI\Bin;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;
C:\Program Files\gs\gs10.04.0\bin;C:\Program Files\CMake\bin;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR;
C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin;C:\Program Files (x86)\Simply Fortran 3\mingw-w64\x86_64-w64-mingw32\lib32;
C:\Program Files (x86)\Simply Fortran 3\mingw-w64\x86_64-w64-mingw32\lib;
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;
C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer;
C:\Program Files\Git\cmd;C:\Users\Jeff\AppData\Local\Microsoft\WindowsApps;
I also have Visual Studio 2022 but it is not in the path. I use Git to successfully clone the source code from Los Alamos into D:_Nuclear\LANL\NJOY\NJOY2016\NJOY2016>. I then make a build directory and cd into it. I execute the following command:
D:_Nuclear\LANL\NJOY\NJOY2016\NJOY2016\build>cmake -DCMAKE_BUILD_TYPE=Release -Dstatic_libraries=ON -Dstatic_njoy=ON -DCMAKE_EXE_LINKER_FLAGS=-static …/
The responses are:
– Building for: Visual Studio 17 2022
– Found Python3: C:/Program Files/Python313/python.exe (found suitable version “3.13.2”, minimum required is “3.5”) found components: Interpreter
– Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
– The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:8 (project):
No CMAKE_Fortran_COMPILER could be found.
– Configuring incomplete, errors occurred!
Cmake locates the Visual Studio 2022 installation but it has no Fortran compiler. Los Alamos advised me to add the following command to my Cmake command line:
-DCMAKE_Fortran_COMPILER=/my/path/to/fortran/compiler.exe, which for me is:
-DCMAKE_Fortran_COMPILER=“C:\Program Files (x86)\Simply Fortran 3\mingw-w64\bin\gfortran.exe”
But this does not help. I have tried the path with and without double quotes and single quotes with no success.
I am guessing that the problem has something to do with the blanks in the path, but I don’t think I can change the installation path for the Simply Fortran package.
Can anyone advise?