[CMake] Unix make files and CMAKE_EXE_LINKER_FLAGS_RELEASE

Philip Lowman philip at yhbt.com
Fri Feb 6 20:32:11 EST 2009


On Fri, Feb 6, 2009 at 7:48 PM, Neal Meyer <nmeyer at dottedzebra.com> wrote:

> I have something like the following in my CMakeLists file.
>
>  set( CMAKE_EXE_LINKER_FLAGS_DEBUG "-lboost_regex-xgcc40-mt-d" )
>  set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-lboost_regex-xgcc40-mt" )
>
> and then a exe that needs this library to link....
>
> However the makefile doesn't actually add this option in.  If i use
> CMAKE_EXE_LINKER_FLAGS it works fine.  Am I missing something?
>
> using CMake 2.6.2


Neal,

What you have there should be being added to the linker flags for
*executables*.  It at least works fine on my system with 2.6.2 (Linux).  It
will not work for libraries, however, so you probably want something better.

In this light I suggest you try using FindBoost.cmake.  I believe the
version in 2.6.2 should work for your needs although if you have any issues
at all please try[1] CMake 2.6.3 RC 11 and see the updated FindBoost
documentation for debugging options.

find_package(Boost <minimum_version> REQUIRED regex)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo ${Boost_LIBRARIES})


[1] = http://www.cmake.org/files/v2.6/

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090206/360b2ad8/attachment.htm>


More information about the CMake mailing list