The all target was depending on the clean and pngtest targets, but
when running the tests with -jN, those can be executed out of order.
Make the main.o target depend on the clean target instead to fix
this.
The final location and name of a build-target is not determined
until generate-time. However, reading the LOCATION property from
a target is currently allowed at configure time. Apart from creating
possibly-erroneous results, this has an impact on the implementation
of cmake itself, and prevents some major cleanups from being made.
Disallow reading LOCATION from build-targets with a policy. Port some
existing uses of it in CMake itself to use the TARGET_FILE generator
expression.
Use CXXFLAGS in the makefile's link rule since it invokes the C++
compiler front-end. Retool the makefile not to require GNU Make. Using
backticks instead of $(shell ...) is safe so long as one guards against
the possibility of backslashes getting inside the backticks, so use
temporary files and shell variables to avoid them.
Instead of relying on that some development package is installed on the
system, now a tiny library is built, which is the searched and used
during the test.
Alex