[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Full source path in generated ninja build file?
From:       Chaoren Lin via CMake <cmake () cmake ! org>
Date:       2016-05-25 18:54:21
Message-ID: CALgjubkVStxKEZ2T-pg2Oex8DaMmX3SDZnrQ9JjC0W0tjbkrqA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi, currently if the build directory is under the project's root, and the
generator is ninja, the generated build files will use relative paths from
the build directory for the source files.

E.g., if we have a project and its build directory structured like this:

project/
    CMakeLists.txt
    src/
        foo.cpp
    build/
        CMakeCache.txt
        CMakeFiles/...
        build.ninja

build.ninja will contain something like this:

build CMakeFiles/foo.dir/src/foo.cpp.o: CXX_COMPILER_foo ../src/foo.cpp

Now, when you build, and get a compile error, the reported path would be
relative to the build directory. This is a somewhat problematic if the
build is being run through an IDE that has no concept of the build
directory (e.g., it's only supplied with a build command, no concept of
what's in the command), since the IDE then can't do anything with the
relative path that comes out of the compiler error. The IDE won't be able
to open the correct source file when receiving the error.

Currently source files in the ninja generator are converted to "NinjaPath"
which are just full paths converted to HOME_OUTPUT. Is there a reason we
can't just always use full paths for the source files?

Thanks,
Chaoren

[Attachment #5 (text/html)]

<div dir="ltr">Hi, currently if the build directory is under the project&#39;s root, \
and the generator is ninja, the generated build files will use relative paths from \
the build directory for the source files.<div><br></div><div>E.g., if we have a \
project and its build directory structured like \
this:<div><br></div><div>project/</div><div>      CMakeLists.txt</div><div>      \
src/</div><div>            foo.cpp</div><div>      build/</div><div>            \
CMakeCache.txt</div><div>            CMakeFiles/...</div><div>            \
build.ninja</div><div><br></div><div>build.ninja will contain something like \
this:</div><div><br></div><div>build CMakeFiles/foo.dir/src/foo.cpp.o: \
CXX_COMPILER_foo ../src/foo.cpp</div></div><div><br></div><div>Now, when you build, \
and get a compile error, the reported path would be relative to the build directory. \
This is a somewhat problematic if the build is being run through an IDE that has no \
concept of the build directory (e.g., it&#39;s only supplied with a build command, no \
concept of what&#39;s in the command), since the IDE then can&#39;t do anything with \
the relative path that comes out of the compiler error. The IDE won&#39;t be able to \
open the correct source file when receiving the \
error.</div><div><br></div><div>Currently source files in the ninja generator are \
converted to &quot;NinjaPath&quot; which are just full paths converted to \
HOME_OUTPUT. Is there a reason we can&#39;t just always use full paths for the source \
files?</div><div><br></div><div>Thanks,</div><div>Chaoren</div></div>



-- 

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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic