0

Let's say, now I have a step

add_custom_command(TARGET MyTarget POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy ${PROJECT_ROOT}/libs/somelib/Debug/lib.dll ${PROJECT_ROOT}/bin/Debug/ COMMENT "Copying dependency dll to output directory" )

I want to change it so that, if Visual Studio build is called for Debug configuration, it uses different paths from when it is called for Release configuration.

How to achieve this?

frp
  • 1,119
  • 1
  • 10
  • 30
  • You may want to look at [how do I make cmake output into a 'bin' dir?](http://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir). In your approach you should not forget to copy the `.pdb` files also. – Florian Sep 03 '15 at 09:03

1 Answers1

1

You can use generator-expressions as arguments for add_custom_command.

E.g., expression $<CONFIG> is evaluated to the build type, $<TARGET_FILE_DIR:MyTarget> is evaluated to the directory, where executable or library is generated.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153