Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Flymake for the CMake build system

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://
cd cmake-flymake
ln -s "$PWD"/cmake-flymake-{generate,remove} ~/bin # or wherever you put your scripts


  1. 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
  2. Open your file in Emacs.

  3. M-x flymake-mode

  4. Enjoy the incremental compilation!

Other Notes

  • When you change any of your CMakeLists.txt files, re-run cmake .. and cmake-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 like find build -name flags.make, e tc.


Scripts for using Emacs Flymake with the CMake build system, based on the original scripts from <>.



No releases published


No packages published


You can’t perform that action at this time.