[PATCH] D93778: [test-suite] Support Fortran tests in CMake infrastructure.

Nichols A. Romero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 12:36:37 PST 2021


naromero77 added inline comments.


================
Comment at: SingleSource/UnitTests/Fortran/CMakeLists.txt:1
+file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.f90 *.F90 *.f *.F)
+
----------------
Meinersbur wrote:
> naromero77 wrote:
> > Meinersbur wrote:
> > > Isn't this redundant with what `llvm_singlesource` does anyway?
> > Good question and I didn't know the answer until after I did a little bit of experimentation.
> > 
> > `Source` is an input variable into `llvm_singlesource()`, without it the target is built in the wrong directory and CMake complains.
> > 
> > The structure of `CMakeLists.txt` is similar to what is done elsewhere in the testsuite:
> > https://github.com/llvm/llvm-test-suite/blob/master/SingleSource/UnitTests/C%2B%2B11/CMakeLists.txt#L4-L9
> There's something wrong if this is not working without defining `Source`. See `cmake/modules/SingleMultiSource.cmake`:
> ```
>   if(DEFINED Source)
>     set(sources ${Source})
>   else()
>     file(GLOB sources *.c *.cpp *.cc *.f *.F *.f90 *.F90)
>   endif()
> ```
> i.e. if `Source` is undefined, it does the file search by itself. Defining `Source` should only be necessary if there are additional source files that should not be compiled. I don't know why `SingleSource/UnitTests/C++11` does it this way. The majority of other programs rely on that it does work.
Thanks for pushing on this. 

The problem was that Fortran tests came at the end of the CMakeLists.txt file, so unbeknownst to me this line in the parent CMakeLIsts.txt file was interfering:
https://github.com/llvm/llvm-test-suite/blob/master/SingleSource/UnitTests/CMakeLists.txt#L15

I just moved up the Fortran test to be enabled before this line.


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93778/new/

https://reviews.llvm.org/D93778



More information about the llvm-commits mailing list