I want to add a test target that is dependant on the whole of a project being built successfully, without re-specifying dependencies on all the libraries or executables.

I would write this in make as:

```
all: foo bar

foo: ...
bar: ...

test: all
    test.sh

```

test.sh implicitly uses foo and bar and wants them to be up to date.

This is how I would expect to specify this in cmake.

```
add_library(foo ...)
add_executable(bar ...)

add_custom_target(test test.sh
              DEPENDS all
)

```

However this does not work as there is no all target.

Is there a way to specify this? Or is there a variable that expands to all the targets I am trying to build?