In a case where both Fortran and C or CXX languages are defined, the path through the omp module at present would add OpenMP flags to CMAKE_Fortran_FLAGS, then set(OPENMP_FOUND TRUE), then find_package(OpenMP) never gets run, so C/CXX never get OpenMP flags appended.
I think the logic you want is more like the below, where the pedestrian Fortran checking is only a fallback when the FindOpenMP is too old to support Fortran.
In a case where both Fortran and C or CXX languages are defined, the path through the
omp
module at present would add OpenMP flags toCMAKE_Fortran_FLAGS
, thenset(OPENMP_FOUND TRUE)
, thenfind_package(OpenMP)
never gets run, so C/CXX never get OpenMP flags appended.I think the logic you want is more like the below, where the pedestrian Fortran checking is only a fallback when the FindOpenMP is too old to support Fortran.
To get the newer Intel OpenMP flag
-qopenmp
, I also grabbed some lines from the FindOpenMP module: https://github.com/Kitware/CMake/blob/master/Modules/FindOpenMP.cmake#L84-L91FYI, @robertodr