开发者

How do I set the build path in cmake?

I开发者_如何转开发 am a total newb to cmake, I am kind of overwhelmed at the moment.

The library I am using creates a visual studio project file using cmake. I would like to edit the cmake file so that it changes the "Output Directory" of the visual studio project to "../../../build/$(Configuration)/". I have no idea how to do this though.


Try adding these lines to your CMakeLists.txt file:

set(dir ${CMAKE_CURRENT_SOURCE_DIR}/../../build)
set(EXECUTABLE_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)
set(LIBRARY_OUTPUT_PATH ${dir} CACHE PATH "Build directory" FORCE)


I ran into the same problem and ended up using CMAKE_RUNTIME_OUTPUT_DIRECTORY to set it. For your case it would be: set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../build)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜