CMake Debug and Release Builds (in Eclipse)

While coding recently in C++ on a project that uses CMake, I needed to build my code with Debug settings in Eclipse.  It’s Eclipse, so there are probably many ways to do it.  I followed this approach.

I ran into one small problem.  I was modifying a project that I had already been working with.  So when I tried running the cmake commands to generate the Release and Debug makefiles

mkdir Release Debug
cmake -E chdir Debug/ cmake -G "Unix Makefiles" ../ -DCMAKE_BUILD_TYPE:STRING=Debug
cmake -E chdir Release/ cmake -G "Unix Makefiles" ../ -DCMAKE_BUILD_TYPE:STRING=Release

nothing was written to the Release or Debug folder.  To fix this, I had to first delete the CMakeCache.txt file from my project folder.

rm CMakeCache.txt

Tags: , , , ,

Leave a Reply