[CMake] find_package with config file always set xyz_FOUND to true?
Anton Deguet
anton.deguet at jhu.edu
Mon Aug 29 18:02:50 EDT 2011
Hello,
I am trying to use the following syntax:
find_package (xyz REQUIRED xyz1 xyz2) using a config file, i.e. NOT Findxyz.cmake.
I have a file named xyz-config.cmake that contains some code to check if the required components are available or not (based on how xyz was compiled). Ideally I would like the find_package command to set xyz_FOUND to false if:
- xyz-config.cmake file is not found (that's working by default)
OR
- xyz-config.cmake file is found BUT one or more component is missing
In my xyz-config.cmake, I tried:
- set (xyz_FOUND FALSE) # overall package not found as required
- set (xyz2_FOUND FALSE) # component not found, hoping find_package would compare this to the list xyz_FIND_COMPONENTS
But in all cases, it seems that find_package resets xyz_FOUND to 1 as long as the file xyz-config.cmake is found. Is there a way to set xyz_FOUND to 0 within xyz-config.cmake?
Anton
More information about the CMake
mailing list