[CMake] Using Boost in XCode

Stefan Huber msnexploder at gmail.com
Mon Sep 15 12:42:30 EDT 2008


Hey Guys,

just tried to create a new C++ Project using the Boost Library with CMake.
Everything works great using Unix Makefiles but building with Xcode failed.

Compiling works without problems but there are some problems linking with
the boost library.

Line Location Tool:0: collect2: ld returned 1 exit status
Line Location Tool:0: symbol(s) not found
Line Location Tool:0:
__ZN5boost15program_options19options_description21m_default_line_lengthE$non_lazy_ptr
in first.o
Line Location Tool:0:
"boost::program_options::options_description::m_default_line_length",
referenced from:
Line Location Tool:0:
boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&>)in first.o
Line Location Tool:0:
"boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&>)", referenced from:

My (testing) CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 2.6)
find_package(Boost 1.36 COMPONENTS program_options)
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
add_executable(test first.cpp)
target_link_libraries(test ${Boost_LIBRARIES})

I tried to compile the first program_options example from the boost package
(also attached).

Software I'm using:

MacOS 10.5.4 Intel
XCode 3.1.1
CMake 2.6.1
Boost 1.36.0

Anybody can help me out using Boost within cMake?

Best regards,
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080915/f87e2e97/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: first.cpp
Type: application/octet-stream
Size: 1268 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080915/f87e2e97/attachment.obj>


More information about the CMake mailing list