[CMake] Visual Studio and dynamic project

ariasgore at gmx.de ariasgore at gmx.de
Mon May 25 05:28:02 EDT 2009


Hello,

I have a project which is supposed to be built as static and dynamic one. Visual studio has this annoying behaviour to add always a debug and a release directoriy to the output directory.
So this is fixed by prefixing the path with ../

IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
	# this prevents generation of /debug or /release directories
	SET_TARGET_PROPERTIES( ${PROJECTNAME} PROPERTIES  PREFIX "../" )
ENDIF( CMAKE_GENERATOR MATCHES "Visual Studio" )

ok, this was easy. The static lib is now indeed generated in the desired location BUT when it comes to the dynamic compilation the DLL is placed correctly in the output directory BUT the import library is always put in a debug or release subdirectory which is quite annoying.
This behaviour can be controlled in Visual Studio by modifying the /IMPLIB command.

How can I do this in my cmake project? The aim is not to link another project to this dynamic library but to create the .lib in the same directory where the .dll file is.

I have tried things mentioned here: http://www.vtk.org/Wiki/CMake_2.6_Notes

eg:
 set_property(TARGET bar PROPERTY IMPORTED_LOCATION c:/path/to/bar.dll)
 set_property(TARGET bar PROPERTY IMPORTED_IMPLIB c:/path/to/bar.lib)

but this looks like an executable gets linkd to a library which is not what I want.

Thanks
Sam
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02


More information about the CMake mailing list