find_package Config file with components

Viewed 3630

i have a cmake package with a Config file supporting components, e.g.

find_package(myPack REQUIRED COMPONENTS foo bar)

in myPackConfig.cmake I typically do

foreach(comp ${myPack_FIND_COMPONENTS})
    if(TARGET myPack::${comp})
         find_package(${comp})
    endif()
endif()

i.e. loop all components and find them. But is it possible to include ALL components if none is given? E.g. when doing

find_package(myPack)

I want to have ALL components (foo, bar, baz et.c.)

thanks

1 Answers
Related