cmake: avoid warnings with CMake 3.0

Policy CMP0046 disallows adding non-target dependencies to targets.
Check if SDL is a target before adding the dependency.
cmake: use generator expression for testing

Policy CMP0026 deprecates the LOCATION property. Instead, use a
generator expression to get the location of the output of the target.
This feature was added in 2.8.0, so no version bump is required.