I want to build a specific feature of a GUI only if a certain component of a package is found. If not, the GUI should be built either way, but without this feature. The idea would be something like this, but I don't know the correct notation (or even if it is possible at all) to check the component itself:
find_package(Qt5 QUIET COMPONENTS Core Widgets OPTIONAL_COMPONENTS Charts)
if (Qt5_FOUND)
message(STATUS "Gui enabled")
...
if (Charts_FOUND) // This is the check I want to make
message(STATUS "Optional feature enabled")
...
else()
message(STATUS "QtCharts not found")
endif()
...
In cmake documentation: Finding Packages, in the Built-In Find Modules it says..
<XX>_<YY>_FOUND
If false, then the optional <YY> part of <XX> package is unavailable.
So I tried if(Qt5_Charts_FOUND)
, but still, QtCharts is not found.
I am sure QtCharts is installed and working.