0
votes

What is the recommended way to setup cmake boost dependencies with code that aims to be compiled with visual studio (or any other platform that features by default automatic linking on boost)?

The problems comes at the link process, boost under visual studio automatically adds the library dependencies with the default naming convention, but you still have to manually add the LIBPATH, this under cmake is something like link_directories(${Boost_LIBRARY_DIRS}) but AFAIK using link_directories is discouraged.

If I use target_link_libraries(foo ${Boost_LIBRARIES}) the problem is still there because this only adds additional absolute filenames and does not prevent the automatic linking process to add the relative libs and the linker misses to find them without the directory.

So what is the best practise here, to disable the automatic link features or is there any other way?

1

1 Answers

0
votes

Disable (or don't enable - doesn't it require you to set a define?) the automatic linking.