I'm building a third-party CMake-based C++ project.
Building the project in release mode only takes a couple of seconds. The linking stage takes less than a second (when make
prints Linking CXX executable myproject.exe).
Building in debug mode takes more than a minute. Most of this time is spent linking the executable. This happens even during subsequent builds after minimal changes to the code.
The difference to the release mode seems to be the -g option vs. the -O3 -DNDEBUG options. Is this behavior expected? I've worked on similar sized projects before (~18k LOC), but I've never experienced such a big difference in compile time between debug and release modes.
This takes 50 seconds:
C:\msys64\mingw64\bin\g++.exe -std=c++0x -Wall -Wextra -Wpointer-arith -Wcast-align -fstrict-aliasing -Wno-unused-local-typedefs -fvisibility- inlines-hidden -march=native -g -Wl,--whole-archive CMakeFiles\myproject.dir/objects.a -Wl,--no-whole-archive -o myproject.exe -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\myproject.dir\linklibs.rsp