[CMake] figuring out exact name of boost-regex lib to use
Michael Wild
themiwi at gmail.com
Tue Feb 28 04:28:34 EST 2012
On 02/28/2012 10:00 AM, Bart Vandewoestyne wrote:
> Hello list,
>
> I'm quite new to CMake, still learning my way around... I currently
> have the following in a CMakeList.txt file:
>
> set(BOOST_LIBNAME "boost_regex")
> #set(BOOST_LIBNAME "boost_regex-mt")
> target_link_libraries(airspace ${BOOST_LIBNAME})
>
> On some platforms, it only works if I set the Boost RegEx library name
> to "boost_regex", on others it only works with "boost_regex-mt".
>
> Up until now, I always uncomment the correct form, depending on what
> platform I am (Linux, Cygwin,...) but this is quite annoying. How can I
> figure out automatically the name of the Boost RegEx library to use?
>
> Thanks!
> Bart
Don't do it this way. Use this:
find_package(Boost REQUIRED COMPONENTS regex)
include_directories(${Boost_INCLUDE_DIRS})
# add_executable etc...
target_link_libraries(airspace ${Boost_LIBRARIES})
Michael
More information about the CMake
mailing list