Skip to content

Allow setting `<PackageName>_FOUND` to override find_package

So in @purpleKarrot's Effective CMake, he suggests overriding find_package in the superporject, like this:

set(as_subproject Foo)

macro(find_package)
    if(NOT "${ARG0}" IN_LIST as_subproject)
        _find_package(${ARGV})
    endif()
endmacro()

add_subdirectory(Foo)
add_subdirectory(App)

Although, it is considered bad to override cmake builtins. So instead of doing this, if we were able to define <PackageName>_FOUND so cmake can treat the package as already found:

set(Foo_FOUND ON CACHE BOOL "")
add_subdirectory(Foo)
add_subdirectory(App)

This would achieve the same affect.

Edited by Daniel Pfeifer
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information