|
7 | 7 | #
|
8 | 8 | # Defines helpers to add executables and tests. The entry points to this
|
9 | 9 | # file are:
|
10 |
| -# `llvm_singlesource([PREFIX p] [sources...])`, and |
| 10 | +# `llvm_singlesource([PREFIX p])`, and |
11 | 11 | # `llvm_multisource()`
|
12 | 12 | #
|
13 | 13 | # Following convenience functions provide shortcuts for common test cases:
|
14 | 14 | #
|
15 |
| -# llvm_singlesource([PREFIX p] [sources...]) |
| 15 | +# llvm_singlesource([PREFIX p]) |
16 | 16 | #
|
17 |
| -# Invokes llvm_test_executable() for each C/C++/Fortran source file. |
18 |
| -# If sources is empty, creates test executables for all C/C++/Fortran |
19 |
| -# files in current directory. |
| 17 | +# Invokes llvm_test_executable() for each c/c++ source file. If |
| 18 | +# 'sources is emptyno sources are specified, creates test executables |
| 19 | +# for all C/C++ files in current directory. |
20 | 20 | # Passes optional PREFIX parameter to llvm_test_executable().
|
21 | 21 | #
|
22 | 22 | # llvm_multisource(target)
|
|
27 | 27 | include(TestSuite)
|
28 | 28 |
|
29 | 29 | # Configure the current directory as a SingleSource subdirectory - i.e. every
|
30 |
| -# C/C++/Fortran file is treated as its own test. |
| 30 | +# file in *.{c,cpp,cc} is treated as its own test. |
31 | 31 | function(llvm_singlesource)
|
32 |
| - # PREFIX is optional so it cannot be a named argument. |
33 | 32 | cmake_parse_arguments(_LSARG "" "PREFIX" "" ${ARGN})
|
34 |
| - if(DEFINED _LSARG_PREFIX) |
35 |
| - # Remove "PREFIX" and the associated value from ARGN so that it only |
36 |
| - # contains sources. |
37 |
| - list(REMOVE_AT ARGN 0) |
38 |
| - list(REMOVE_AT ARGN 0) |
39 |
| - endif() |
40 |
| - |
41 |
| - set(sources ${ARGN}) |
42 |
| - if(NOT sources) |
| 33 | + if(DEFINED Source) |
| 34 | + set(sources ${Source}) |
| 35 | + else() |
43 | 36 | file(GLOB sources *.c *.cpp *.cc *.f *.F *.f90 *.F90)
|
44 | 37 | endif()
|
45 |
| - |
46 | 38 | foreach(source ${sources})
|
47 | 39 | basename(name ${source})
|
48 | 40 | set(_target ${_LSARG_PREFIX}${name})
|
|
0 commit comments