Search code examples
emacscedet

Putting CEDET ede-cpp-root-project commands outside the .emacs file


I have a working EDE project, but I would like to locate the command in a file in the source tree for that project and not in my .emacs file. Is this possible?

I have tried using directory variables and emacs loads the file, but it does have any affect. To do this I placed the following code in .dir-locals.el in the project root:

((nil 
 . ((ede-cpp-root-project "MyProj"
     :name "MyProj Project"
     :file "/home/jlisee/projects/myproj_code/CMakeLists.txt"
     :include-path '( "/packages" )
     :system-include-path '( "/opt/myproj/local/include" )
     :spp-table '( ("CONST" . "const") )
     ))))

Solution

  • The project type ede-cpp-root is for people who specifically want to keep the project file out of their source tree. If you want a project type in your source tree, there are other options.

    If you are using a recent version of CEDET, you can instead enable the generic project types which in turn supports cmake (which it looks like you are using?)

    (ede-enable-generic-projects)
    

    Once in this generic project for CMake, use

     M-x ede-customize-project RET
    

    to add in include paths, macro tables, and the like.

    If you aren't using makefiles, cmake, or whatever, you can create your own generic project type with a bit of code in your .emacs file. Look in ede-generic for everything that mentions CMake, and it should be pretty obvious what 3 things to create.

    I think the existing project type uses CMakeLists, not CMakeLists.txt, so perhaps the existing code needs a tweak.