You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
CMake and Boost are moving to targets. Hence if you want to use e.g. Boost.ProgramOptions you have to target_link_libraries(target PUBLIC Boost::program_options) which always works
However here you only link the executable (and not also the libraries) to the boost libraries and use the (discouraged) include_directories("${Boost_INCLUDE_DIRS}") which is problematic:
Quoting the value may not expand a list of directories -> Remove the quotes
It might be empty (e.g. for the Boost CMake config option) -> Empty value added, again: Remove the quotes
It only works with the legacy FindBoost which doesn't work well going forward -> Use target_link_libraries as suggested above INSTEAD
Bottom line: Do not use functions like include_directories where a target_* function exists. Also use target_link_libraries to declare the dependencies of your targets (the naming is a bit misleading, it is not necessarily "linking" but declaring a dependency to another target which may imply linking or "just" adding header paths)
The text was updated successfully, but these errors were encountered:
CMake and Boost are moving to targets. Hence if you want to use e.g. Boost.ProgramOptions you have to
target_link_libraries(target PUBLIC Boost::program_options)
which always worksHowever here you only link the executable (and not also the libraries) to the boost libraries and use the (discouraged)
include_directories("${Boost_INCLUDE_DIRS}")
which is problematic:Bottom line: Do not use functions like
include_directories
where atarget_*
function exists. Also usetarget_link_libraries
to declare the dependencies of your targets (the naming is a bit misleading, it is not necessarily "linking" but declaring a dependency to another target which may imply linking or "just" adding header paths)The text was updated successfully, but these errors were encountered: