[CMake] How to place .dll and .lib in different places?

Luigi Calori l.calori at cineca.it
Mon Aug 27 06:08:26 EDT 2007


I have the problem of placing, at build time .lib in one folder (lib) 
and .dll in another (bin)
One solution is to add POST_BUILD copy commands, but i would prefer not.
I have also been suggested to use
SET_TARGET_PROPERTIES ...  PROPERTIES PREFIX
being lib and bin sibling, this hack seem to work:

SET(LIBRARY_OUTPUT_PATH <lib>)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/")


Is it "supported" or works by chances?

I ask, because, I have also tried
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/lib")

to being able to have
<lib_name>.lib in lib/Release
<lib_name>d.lib in lib/Debug

and

lib<lib_name>.dll and lib<lib_name>d.dll both in bin

Unfortunately this is working in debug but not in release mode.

Thanks in advance

Luigi





More information about the CMake mailing list