Create cscope.out files in a separate directory

I have the source code for a huge project in one directory (/ my / src /), and I want the cscope files to be created in another directory (/ my / db /). How can i do this?

+6
source share
2 answers

Try the following steps:

1. Create cscope.files

find /my/src -name '*.c' -o -name '*.h' > /my/db/cscope.files

2. Run cscope for the generated result

cscope -i /my/db/cscope.files

3. Export to environment variable

CSCOPE_DB=/my/db/cscope.out; export CSCOPE_DB 
+16
source

If you have a large number of files that are not part of git repo, and if this unnecessarily slows down the cscope command. You can use the following command to create a cscople file (will work for a java / javascript / python / c / go / c ++ project).

git ls-files | grep '\.js$\|\.java$\|\.py$\|\.go$\|\.c$\|\.cpp$\|\.cc$\|\.hpp$' > /my/db/cscope.files
cscope -b -i /my/db/cscope.files
CSCOPE_DB=/my/db/cscope.out; export CSCOPE_DB 
0
source

All Articles