在CMakeLists文件中指定构建目录 [英] Specifying build directory within CMakeLists file
问题描述
是否可以在CMakeLists文件中指定构建目录?如果是,怎么办。
Is it possible to specify build directory within CMakeLists file? If yes, how.
我的目标是能够在顶级源目录中调用 cmake,并让cmake找出构建目录。
My aim is to be able to call "cmake" within top level source directory and have cmake figure out the build directory.
推荐答案
Afaik,使用 CMake
,构建目录始终是您调用 cmake
或 ccmake
命令。因此,如果要更改构建目录,则必须在运行CMake之前更改目录。
Afaik, with CMake
the build directory is always the directory from where you invoke the cmake
or ccmake
command. So if you want to change the build directory, you have to change directories before running CMake.
要控制可执行文件,静态库和共享库一旦完成放置的位置,您可以分别修改 CMAKE_RUNTIME_OUTPUT_DIRECTORY
, CMAKE_ARCHIVE_OUTPUT_DIRECTORY
和 CMAKE_LIBRARY_OUTPUT_DIRECTORY
。
To control the location where executables, static and shared libraries are placed once finished, you can modifiy CMAKE_RUNTIME_OUTPUT_DIRECTORY
, CMAKE_ARCHIVE_OUTPUT_DIRECTORY
, and CMAKE_LIBRARY_OUTPUT_DIRECTORY
respectively.
这篇关于在CMakeLists文件中指定构建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!