OK, now I have it: add_custom_target (syntax-check COMMAND $(CXX) $(CXXFLAGS) -Wall -Wextra -pedantic -fsyntax-only $(CHECK_SRC) VERBATIM) But how can I get there the Defines and Includes from regular target compile? Thanks, Olaf