[CMake] Windows library target names

John Drescher drescherjm at gmail.com
Thu Jul 22 17:35:43 EDT 2010


>   You _can_ very easily do this if you want. The code is out there in the
> wild in the form of macros that can be invoked from CMake that will set all
> of this up for you. You just have to look for it (or ask the right person...
> )
>

I do this for my shared libraries although I do not put them all in 1
folder. I add postfixes for debug and release and for compiler version
in windows since mixing compiler versions is not a good idea.

One example of this is:

	IF(MSVC90)
		SET(CMAKE_DEBUG_POSTFIX "_d_2008")
		SET(CMAKE_RELEASE_POSTFIX "_2008")
		SET(CMAKE_RELWITHDEBINFO_POSTFIX "_2008")
	ENDIF(MSVC90)
	
	IF(MSVC80)
		SET(CMAKE_DEBUG_POSTFIX "_d_2005")
		SET(CMAKE_RELEASE_POSTFIX "_2005")
		SET(CMAKE_RELWITHDEBINFO_POSTFIX "_2005")
	ENDIF(MSVC80)
	
	IF(MSVC71)
		SET(CMAKE_DEBUG_POSTFIX "_d_2003")
		SET(CMAKE_RELEASE_POSTFIX "_2003")
		SET(CMAKE_RELWITHDEBINFO_POSTFIX "_2003")
	ENDIF(MSVC71)
	
	IF(MSVC70)
		SET(CMAKE_DEBUG_POSTFIX "_d_2002")
		SET(CMAKE_RELEASE_POSTFIX "_2002")
		SET(CMAKE_RELWITHDEBINFO_POSTFIX "_2002")
	ENDIF(MSVC70)
	
	IF(MSVC60)
		SET(CMAKE_DEBUG_POSTFIX "_d_vc6")
		SET(CMAKE_RELEASE_POSTFIX "_vc6")
		SET(CMAKE_RELWITHDEBINFO_POSTFIX "_vc6")
	ENDIF(MSVC60)

And then I generate a USE file (using configure_file) for the project
that allows client applications to linking with the correct version
for each configuration configuration.

John


More information about the CMake mailing list