CMake: how to specify different steps for differen

2019-09-05 12:47发布

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?

1条回答
看我几分像从前
2楼-- · 2019-09-05 13:49

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.

查看更多
登录 后发表回答