[CMake] cmake output files and different platforms.

Jakub Zakrzewski slither.jz at gmail.com
Tue Aug 4 15:07:30 EDT 2015


Hi,

your problem has two natures. From the terminal you're most probably using
the "Unix Makefiles" generator. For xcode it's a multi-configuration
generator that adds the build configuration to the path. Now, about
CLion... it seems to run CMake by itself in a directory of it's choice.
You'll have a hard time with it.

> is there a way to make these filenames consistent so that I when I try to
load some resources my code doesn't break?

Easily - use relative paths in your code and make sure you set the right
working directory when running.

On 4 August 2015 at 11:42, Owen Alanzo Hogarth <gurenchan at gmail.com> wrote:

> 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?
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Pozdrowienia
Jakub Zakrzewski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150804/4a6b0993/attachment.html>


More information about the CMake mailing list