[CMake] Managing library name decorations

Brad King brad.king at kitware.com
Fri Aug 25 13:18:56 EDT 2006


Anders Sundman wrote:
> Boost will produce the library files: "libboost_date_time-gcc-mt-s.a" or
> "boost_date_time-gcc.lib", or add some other nifty suffix. The
> decorations specifying toolset, run-time, etc. that the library was
> compiled with.

CMake has no formal knowledge of such decorations.  This may change in
the future but for now it is up to user code to deal with them.

> Up till now, I've used a variable (eg. = "-gcc-mt-s") that the user must
> set during configure; but this seems like sub optimal solution. Maybe
> this is the only solution if there are multiple boost libraries
> installed, but otherwise it would be great if CMake could guess the
> decoration automatically.

Are you talking about finding the installed boost library with a
FIND_LIBRARY?  You should be able to identify most of the information
you need to compute the name of the desired library in CMake code.  For
example:

IF(CMAKE_COMPILER_IS_GNUCXX)
  SET(TOOLSET "-gcc")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC7)
  SET(TOOLSET "-vc7")
ENDIF(MSVC7)

-Brad


More information about the CMake mailing list