[CMake] Multiple output names in post-build commands with MSVC?

Kenny Erleben kenny at diku.dk
Thu May 24 07:03:38 EDT 2007


Hi all,

I need multiple output names to install both release and debug versions 
of my static libs, I tried to go about this as follows

ADD_LIBRARY( xxx  ....   )

SET_TARGET_PROPERTIES(xxx PROPERTIES DEBUG_OUTPUT_NAME "xxxD")
SET_TARGET_PROPERTIES(xxx PROPERTIES RELEASE_OUTPUT_NAME "xxx")

GET_TARGET_PROPERTY(XXX_LOCATION xxx LOCATION)

ADD_CUSTOM_COMMAND(
  TARGET xxx
  POST_BUILD
  COMMAND ${CMAKE_COMMAND}
  ARGS -E copy ${XXX_LOCATION}  some_install_lib_folder
)

This works fine if I compile my release configuration but fails for the 
debug configuration. Is there any nice solution for doing this?

What I really would love would be something like

SET_TARGET_PROPERTIES(xxx PROPERTIES DEBUG_OUTPUT_PATH "some_path")
SET_TARGET_PROPERTIES(xxx PROPERTIES RELEASE_OUTPUT_PATH "some_path")

But I have not been able to find anything in CMake that can do this?

I should mention that I do have other targets in my project with libs 
going into differnet folders so I can not use LIBRARY_OUTPUT_PATH.

thanks

/Kenny


More information about the CMake mailing list