开发者

How do I set the build path in cmake?

开发者 https://www.devze.com 2023-03-05 17:35 出处:网络
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 t

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

精彩评论

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