New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I point to a compile_commands.json out-of-source? #50

Closed
geokon-gh opened this Issue Aug 22, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@geokon-gh

geokon-gh commented Aug 22, 2018

So I thought this was more common, but I have everything setup to build out-of-source using CMake. (My source actually lives on a USB drive and I move it from machine to machine)

To make it more concrete:

I have my code in /home/geokon/USB/Projects/someproject
So there will be a /home/geokon/USB/Projects/someproject/CMakeLists.txt and some folder with my source files like /home/geokon/USB/Projects/someproject/src

But I'm building somewhere completely else like

/home/geokon/SomeBuildArea
and it'll have a
/home/geokon/SomeBuildArea/CMakeCache.txt
/home/geokon/SomeBuildArea/compile_commands.json
and libs, binaries etc.

So can I somehow tell cquery the path to a compile_commands.json for a source tree somewhere completely else? Or do I set the project root to be the build directory and it will magically work with all my source files that aren't actually under the same file root?

I could make some hack to move the compile_commands.json to the source directory.. but I'd like to really avoid doing that.

Thanks! This is a really awesome project. Hope I can get it working for my setup :)

@vanjoe

This comment has been minimized.

Show comment
Hide comment
@vanjoe

vanjoe Aug 23, 2018

As far as I can tell it only looks for a compile_commands.json or a builds/compile_commands.json in a directory that is (grand-)*parent of the file. I also find this a bit annoying because for various reasons I don't always call my build directory "build"

vanjoe commented Aug 23, 2018

As far as I can tell it only looks for a compile_commands.json or a builds/compile_commands.json in a directory that is (grand-)*parent of the file. I also find this a bit annoying because for various reasons I don't always call my build directory "build"

@geokon-gh

This comment has been minimized.

Show comment
Hide comment
@geokon-gh

geokon-gh Aug 24, 2018

Hmmm, yeah. I'm trying to see if I can somehow patch it in.

@vanjoe are you looking at this line? https://github.com/cquery-project/emacs-cquery/blob/master/cquery.el#L115

I'm not so hot with ELisp macros... I can't really tell where it goes from here

geokon-gh commented Aug 24, 2018

Hmmm, yeah. I'm trying to see if I can somehow patch it in.

@vanjoe are you looking at this line? https://github.com/cquery-project/emacs-cquery/blob/master/cquery.el#L115

I'm not so hot with ELisp macros... I can't really tell where it goes from here

@dscole

This comment has been minimized.

Show comment
Hide comment
@dscole

dscole Sep 4, 2018

@geokon-gh I just create a symlink:

ln -s path/to/build/dir/compile_commands.json -rt /path/to/project/root

dscole commented Sep 4, 2018

@geokon-gh I just create a symlink:

ln -s path/to/build/dir/compile_commands.json -rt /path/to/project/root

@geokon-gh

This comment has been minimized.

Show comment
Hide comment
@geokon-gh

geokon-gh Sep 10, 2018

@dscole Yeah, that a quick hack that works. Thanks :)

I realize there is no real obvious way to easily automate this (b/c there is no CMake build tool in Emacs as of yet) - but I'd like to be able to just have the ability to redirect the compile_commands.json from within Emacs/Cquery. It'd make the workflow a lot smoother and easier to automate. Having to make a new simlink each time I make a new build directory is less clean (and if you make many build directories it's a bit impractical)

geokon-gh commented Sep 10, 2018

@dscole Yeah, that a quick hack that works. Thanks :)

I realize there is no real obvious way to easily automate this (b/c there is no CMake build tool in Emacs as of yet) - but I'd like to be able to just have the ability to redirect the compile_commands.json from within Emacs/Cquery. It'd make the workflow a lot smoother and easier to automate. Having to make a new simlink each time I make a new build directory is less clean (and if you make many build directories it's a bit impractical)

@jacobdufault

This comment has been minimized.

Show comment
Hide comment
@jacobdufault

jacobdufault Sep 10, 2018

Member

You can use the compilationDatabaseDirectory init option for this.

Member

jacobdufault commented Sep 10, 2018

You can use the compilationDatabaseDirectory init option for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment