'CMake: how to test *.cmake files? How to test find_package works?

CMake: how to test *.cmake files? How to test find_package works?

On an open-source project available here : https://github.com/opencollab/arpack-ng/pull/342, we had created *.cmake files for users to have find_package to work. For this, we had to write *.cmake files. Problem is: these *.cmake files are always blind pushed, no way to test them.

Tried to had a test that install the software, and, then runs find_package to find and use the software: unfortunatelly, this consistently fails with errors like 'add_library\add_custom_target\set_target_properties command is not scriptable'

How to test find_package works ? Any help/clue is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source