Add a way to tell CMake to assume that a package is available
I have a main package/project with a sub-directory which I would like to be able to build both as a standalone project AND as a sub-directory of the main project. In order to be buildable as a standalone project, the sub-project needs to import the main package/project using the following:
project(MySubPackage) find_package(MyMainPackage REQUIRED)
However, if that sub-project is included in the main project (with add_subdirectory()), "find_package" complains that it can not find the corresponding package. CMake does not seem to offer a way to solve that problem without having to tweak the sub-project to check if it is being built as a standalone package or not.