[CMake] cmake output files and different platforms.

Owen Alanzo Hogarth gurenchan at gmail.com
Tue Aug 4 05:42:51 EDT 2015


I am having a bit of trouble getting this sorted out.

I set
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

in one of my cmakelists.txt file and it works almost as expected. If I use
the terminal to build everything goes where it needs to and then I can
reference the relative location of my files and folders from my c code BUT

if I use xcode to build the same program, xcode seems to append a Debug or
Release to the end of my path breaking all my c code.

sample output below
//    terminal
//    /Users/user/FOLDER/project/build/bin/
//    /Users/user/FOLDER/project/build/bin/resources/

//    xcode
//    /Users/user/FOLDER/project/build/bin/Debug/
//    /Users/user/FOLDER/project/build/bin/Debug/resources/

//   clion
//    /ad053ed7/ad053ed7/Debug/bin/
//    /ad053ed7/ad053ed7/Debug/bin/resources/

As you can see I am getting three different outputs based on the same cmake
file using 3 ways of building.

is there a way to make these filenames consistent so that I when I try to
load some resources my code doesn't break?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150804/ad26a8b1/attachment.html>


More information about the CMake mailing list