[CMake] Intel ifort Windows cmake_fortran_flags: bug or user error?

Michael Hirsch, Ph.D. michael at scivision.dev
Thu Feb 6 22:49:48 EST 2020


I typically "set(CMAKE_Fortran_FLAGS ...)" variable in my CMake
project to set compile flags for all Fortran targets.  Is this
undesired practice?
I haven't had any problems using multiple compilers, *except* for
Intel Ifort on Windows. Ifort on Linux is fine.
Here are the flags that CMake auto-sets for Ifort Windows in
CMAKE_Fortran_FLAGS:

"/W1 /nologo /fpp /libs:dll"

The flag my project needs and that CMake auto-sets is "/libs:dll"
I can workaround this issue by just appending those flags to my flags
in CMAKE_Fortran_FLAGS.

* should I not be setting CMAKE_Fortran_FLAGS manually?
* Is this a CMake "bug" for Ifort on Windows?
* CMake with Ifort on Linux also auto-sets compiler flags like "-fpp"
but doesn't put them in CMAKE_Fortran_FLAGS.


More information about the CMake mailing list