[CMake] Linking with MSVC against Boost lib fails to find library

Stephen Collyer scollyer at netspinner.co.uk
Fri Jul 11 13:20:42 EDT 2008


Doug Gregor wrote:

> 
> So, it looks like Boost's auto-linking is trying to link against the
> static program_options library (with the lib prefix), but CMake has
> found the shared program_options library. You'll need to force it one
> way or the other.
> 
> If you want to force CMake to find the static versions, use
> 
>   SET(Boost_USE_STATIC_LIBS ON)
> 
> before using find_package(Boost).
> 
> To force your program to link against the shared version of the Boost
> libraries, use
> 
>   add_definitions(-DBOOST_ALL_DYN_LINK)

Thanks. That would appear to be the problem. -DBOOST_ALL_DYN_LINK seems
to solve it, but throws up what looks like a bug in the program_options
code, so I'll have to head off to the Boost mailing list now ..

-- 
Regards

Steve Collyer
Netspinner Ltd


More information about the CMake mailing list