Fix compile when option Boost dependencies are not available
We first need to query for the optional components and then for the required ones. See also: https://cmake.org/pipermail/cmake/2010-August/039042.html