[CMake] Linking to a library with a "-"
Michael Jackson
mike.jackson at bluequartz.net
Wed Apr 15 21:24:03 EDT 2009
building Boost with CMake and using FindBoost.cmake are two totally
different things.
Build boost however you want or get the official binaries from
BoostPro.com and install as appropriate.
THEN in your own CMakeLists.txt file use something like the following:
set(Boost_USE_MULTITHREADED ON) # which is the default
FIND_PACKAGE(Boost 1.38 COMPONENTS program_options)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) # Include the Boost Headers
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
add_executable(myFoo ${srcs})
target_link_libraries(myFoo ${Boost_PROGRAM_OPTIONS_LIBRARY} )
This will link your executable to the Boost Program_Options library
from the boost distribution. There is a "FindBoost.cmake" as part of
the CMake distribution and is probably much easier to use than trying
to reinvent it from scratch.
---
Mike Jackson www.bluequartz.net
PS: I was the one who put the "CMake is Experimental" flag in Boost's
own CMake build system at the request of the Boost developers....
On Apr 15, 2009, at 7:26 PM, David Doria wrote:
> Mike, good idea, but I was trying to stay away from boost's cmake
> until they didn't make set a flag saying " I agree this is
> experimental" haha.
More information about the CMake
mailing list