I just spent two hours of debugging until I found an interesting problem. In my package-configuration, I write
include("${CMAKE_CURRENT_LIST_DIR}/@MY_PROJECT_NAME@Targets.cmake")
Through a copy-paste-error, the variable MY_PROJECT_NAME
was not defined, so the code resolved to
include("${CMAKE_CURRENT_LIST_DIR}/Targets.cmake")
This did not trigger an error with cmake, even though I understand such a file should not exist. Is it possible that the include()
statement falls through missing files without error? That seems horrible. Or am I on the wrong track here?