Yes,

after more reading and thinking, I think it might need some adaptation of the tools. CMake targets NVCC, I was kinda hoping that it would spew out the nvcc options that could then be fed to the tools I want to yo use.

But those specific tools are all clang based, so they probably don't know about nvcc commands. I don't know how genric that compilation database is. (although for what I want, the tools probably only need gcc compatible flags, like -D and -I to recognise defines and include paths. If you tell them to work in C++ mode, you can actually get them to run on *.cu files as clang knows about CUDA, so they just need to know about include paths.)

Maybe it would work if I made a CMake file without using NVCC to target clang directly as a specific compiler for *.cu file.

So from what I currently understand, what you suggest might be the simplest. Parse the verbose output and make my own compilation database.

Thanks,

Urs



On 10/19/18 5:26 PM, Dmitry Mikushin wrote:
Presuming makefile target, would it help if after CMake you do "make VERBOSE=1" ? Verbose mode should show all compilation commands, maybe you could further parse them into the format you want.

Kind regards,
- Dmitry.

пт, 19 окт. 2018 г. в 18:17, Urs <nab+cm...@lampshade.ch <mailto:nab%2bcm...@lampshade.ch>>:

    Hi,

    I'm trying to get CMake to output a compilation database for my
    project
    using gcc and CUDA (nvcc). I'd use the compile_commands.json file for
    rtags navigation in emacs and clang-tidy inspection.

    To do that, I just added

    set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

    to my CMakeLists.txt

    But it looks like the output I get is only having the information for
    the *.cpp files. It looks like the *.cu files are all compiled as
    external objects taht have their own cmake code in subroutines and
    are
    not built by the Makefile generator.

    I'm not a cmake expert, is what I'm trying to do possible? Am I doing
    something wrong somewhere?

    Thanks,

    Urs

--
    Powered by www.kitware.com <http://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:
    https://cmake.org/mailman/listinfo/cmake

-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to