The canonical way to select Qt components in CMake is to specify the them in the find_package
call and then to include ${QT_USE_FILE}
FIND_PACKAGE( Qt4 COMPONENTS QtWebKit REQUIRED )
INCLUDE( ${QT_USE_FILE} )
...
TARGET_LINK_LIBRARIES( corrections ${QT_LIBRARIES} )
This already configures the include directories and sets ${QT_LIBRARIES}
to contain all relevant Qt libraries (i.e. your selected component and all Qt libraries it depends on).
So you don't need to manually add the libraries by listing them individually as you did in your example.
Edit:
Additional explaination:
The COMPONENT
parameter to FIND_PACKAGE
actually does the same as your manual call to set QT_USE_WEBKIT
. But this variable is only evaluated/used in UseQt4.cmake
which is included (and "executed") by the INCLUDE
command. See CMake documentation of FindQt4 for details.