FPHSA: fix when found version is 0 or when cache variable VERSION exists
This patch fixes a problem that can be observed if the found version of a library is 0 or if a cache variable with name VERSION exists. In my case, the latter was the case.
Example CMakeLists.txt
:
cmake_minimum_required(VERSION 3.5)
find_package(OpenGL REQUIRED)
Output of configuration step with cache variable VERSION
:
$ mkdir build && cd build
$ cmake -DVERSION=1.2.3 ..
<snip>
-- Found OpenGL: opengl32 (found version "1.2.3")
<snip>
The fix is inspired by ba907f7d, in which a check for VERSION
was also replaced by a DEFINED
on ${FPHSA_VERSION_VAR}
.
Topic-rename: fphsa-version-cleanup
Edited by Brad King