开发者

How do I get Visual Studio to output new files in a different directory (ideally the source directory from a out of source cmake build)

I am in the process of adding cmake support to a project and noticed that, after generating an out of source Visual Studio project, adding new files through开发者_C百科 Visual Studio puts them in the Build directory, and not in the Source directory. This is suboptimal.

Is there any way to change where VS adds new files, and can I set this in a CMakeLists.txt file?


You can choose the ouput directory for CMake like this:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${MY_DIR})

For Visual Studio projects use this:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${MY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${MY_DIR})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜