These build aliases are only handy for myself, and I’m pretty aware of what I’m doing (at least most of the time 😉 ).

Note: Use ‘-DCMAKE_CXX_FLAGS=-Wall’ to add additional compiler warnings.

$ cat ~/.bashrc

# icinga 2
export CMAKE_OPTS_DEBUG="-DCMAKE_CXX_FLAGS=-Wall -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_BUILD_TYPE=Debug -DICINGA2_USER=icinga -DICINGA2_GROUP=icinga -DICINGA2_COMMAND_USER=icinga -DICINGA2_COMMAND_GROUP=icingacmd"
export CMAKE_OPTS_NORMAL="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_BUILD_TYPE=RelWithDebInfo -DICINGA2_USER=icinga -DICINGA2_GROUP=icinga -DICINGA2_COMMAND_USER=icinga -DICINGA2_COMMAND_GROUP=icingacmd"

alias icinga2_debug='rm -rf debug ; mkdir debug ; cd debug ; cmake $CMAKE_OPTS_DEBUG .. ; sudo make -j4 install ; cd ..'
alias icinga2_normal='rm -rf release ; mkdir release ; cd release ; cmake $CMAKE_OPTS_NORMAL .. ; sudo make -j4 install ; cd ..'

For builds without cmake runs, it’s tremendously easy with make too

$ sudo make -j8 install -C debug/
%d bloggers like this: