These are scripts for using the CMake build system with Flymake, an on-the-fly syntax checker for GNU Emacs. I've found these scripts written by Nil Geisweiller on the OpenCog Wiki, but they didn't work immediately for me. I'm hoping that the modified versions now work rather reliably out of the box. I was linked to them by Flymake with CMake on the EmacsWiki.
These scripts require a few obvious dependencies.
- Emacs 23, which includes Flymake (this is not necessary to run the script, but to use the results)
- GNU bash
- CMake
cd your_projects_dir
git clone git://github.com/seanfisk/cmake-flymake.git
cd cmake-flymake
ln -s "$PWD"/cmake-flymake-{generate,remove} ~/bin # or wherever you put your scripts
-
Follow these project setup instructions:
cd your_cmake_project mkdir build # your build directory cd build cmake .. # create the CMake configs cd .. cmake-flymake-generate build # or whatever you named the build directory
-
Open your file in Emacs.
-
M-x flymake-mode
-
Enjoy the incremental compilation!
- When you change any of your
CMakeLists.txt
files, re-runcmake ..
andcmake-flymake-generate build
. - To remove the Flymake Makefiles, run
cmake-flymake-remove
. - These scripts are configured to use the GNU make variables ${CXX}, ${CXX_FLAGS}, and ${CXX_DEFINES} in the actual Makefiles. This means that the scripts will require editing to work with pure C projects (when using CC, CFLAGS, etc.) or any other language besides C++. This should be quite easy to figure out. Look at the actual Makefiles which get generated for more information.
- I haven't tested this on Windows, but I doubt it will work (it is bash, after all). UNIX-like operating systems (including GNU/Linux, BSD, Mac OS X) should be fine.
- I'd like to not have to parse
CMakeLists.txt
, because I already had some problems in a simple build when I used a variable as my executable name. Alternative approaches involve something likefind build -name flags.make
, e tc.