cmake_minimum_required(VERSION 2.6) macro(add_exec name) add_executable(${name} ${ARGN}) set_target_properties(${name} PROPERTIES COMPILE_FLAGS "-Wall --std=c++0x") endmacro() add_exec(test test.cpp)