diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,6 @@ if(TEST_SUITE_FORTRAN) enable_language(Fortran) - if(NOT CMAKE_GENERATOR STREQUAL "Ninja") - message(WARNING - "Fortran test suite may NOT build with this CMAKE_GENERATOR = ${CMAKE_GENERATOR}.\n" - "Recommend using Ninja 1.10 or later by adding -G \"Ninja\" to cmake invocation.") - endif() endif() function(append value) diff --git a/External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt b/External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt --- a/External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt +++ b/External/SPEC/CFP2017rate/554.roms_r/CMakeLists.txt @@ -4,6 +4,8 @@ return () endif () +ninja_required() + speccpu2017_benchmark(RATE) speccpu2017_add_include_dirs(.) diff --git a/External/SPEC/SpecCPU2017.cmake b/External/SPEC/SpecCPU2017.cmake --- a/External/SPEC/SpecCPU2017.cmake +++ b/External/SPEC/SpecCPU2017.cmake @@ -4,6 +4,7 @@ include(External) include(CopyDir) include(Host) +include(Fortran) # Search for SPEC CPU 2017 root directory. llvm_externals_find(TEST_SUITE_SPEC2017_ROOT "speccpu2017" "SPEC CPU2017") diff --git a/cmake/modules/Fortran.cmake b/cmake/modules/Fortran.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/Fortran.cmake @@ -0,0 +1,29 @@ +##===- Fortran.cmake ----------------------------------------------------===## +# +# Fortran-specific helper functions to build benchmarks and the +# corresponding .test files +# +##===--------------------------------------------------------------------===## + + +# The Ninja generator supports robust scanning for modules that are +# needed by some Fortran tests. Because Ninja does a full +# preprocessing pass on Fortran files, it is able to detect module +# dependencies that are dependent on preprocessing. +# For example, +# #ifdef FOO +# USE MODULE_A +# #else +# USE MODULE_B +# #endif +# This is support by Ninja, but not the Unix Makefiles generator. +# More details here: +# https://gitlab.kitware.com/cmake/cmake/-/issues/16590" + +function(ninja_required) + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + message(SEND_ERROR + "This test is NOT supported by CMAKE_GENERATOR = ${CMAKE_GENERATOR}.\n" + "Please use use Ninja 1.10 or later by adding -G \"Ninja\" to cmake invocation.\n") + endif() +endfunction()