[英]CMake Copy File to Current Working Directory Linux
I want to copy a shared library that is in my source directory to the program's running directory. 我想将源目录中的共享库复制到程序的运行目录中。
In linux we get there using /proc/self/cwd/
在Linux中,我们使用
/proc/self/cwd/
And I am looking in: /proc/self/cwd/CMakeFiles
我正在寻找:
/proc/self/cwd/CMakeFiles
Compiled source files are located here, but I do not see my library.
编译的源文件位于此处,但看不到我的库。
What is the CMake command to do this? CMake命令是做什么的?
I already tried: set(CMAKE_LIBRARY_PATH ./)
我已经尝试过:
set(CMAKE_LIBRARY_PATH ./)
You should look at the manual section Variables that Provide Information . 您应该查看手册部分“ 提供信息的变量” 。 In particular, the variables CMAKE_BINARY_DIR and CMAKE_RUNTIME_OUTPUT_DIRECTORY are useful as destination locations to your build tree.
特别是,变量CMAKE_BINARY_DIR和CMAKE_RUNTIME_OUTPUT_DIRECTORY可用作构建树的目标位置。 The variables CMAKE_SOURCE_DIR and CMAKE_CURRENT_SOURCE_DIR are useful for source locations.
变量CMAKE_SOURCE_DIR和CMAKE_CURRENT_SOURCE_DIR对于源位置很有用。
Typically, when I am in my top-level project source directory, myproject containg the top-level CMakeLists.txt
file, I use a sibling folder myproject-build
. 通常,当我位于顶级项目源目录中时,myproject包含顶级
CMakeLists.txt
文件,我会使用同级文件夹myproject-build
。 For example 例如
cd $HOME/myproject
mkdir ../myproject-build
cd ../myproject-build
cmake ../myproject
then 然后
Does this help? 这有帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.