如何使用cmake复制dll? [英] How to copy the dll's using cmake?
本文介绍了如何使用cmake复制dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在构建解决方案时,我必须将dll复制到文件夹中。 cmake的结构如下:
I have to copy dll's to a folder while building my solution. The structure of cmake as follows:
D:/src/cmakeLists.txt
D:/target/runtime/bin
D:/repos/stable/compiler/xyz.dll
所以我要将xyz.dll复制到 D:/ target / runtime / bin。我在cmake中做了如下操作:
So, i want to copy xyz.dll to "D:/target/runtime/bin" . I did as follows in cmake:
add_custom_command(TARGET performance POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/libs/xyz.dll"
$<TARGET_FILE_DIR:performance>)
但是它没有复制任何dll。所以,建议我如何实现它。我对cmake不太熟悉。因此,请提出建议。
But it did not copied any dll. So, suggest me how do i achieve it. I am not much familiar with cmake .So, please suggest.
推荐答案
我使用 configure_file()命令。它将在cmake生成步骤中复制文件。
I use the configure_file() command for that purpose. It copies the file during the cmake generate step.
尝试类似
configure_file("${PROJECT_SOURCE_DIR}/libs/xyz.dll" $<TARGET_FILE_DIR:performance> COPYONLY)
这篇关于如何使用cmake复制dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文