[build2] how to compile different executables with different flags

Alberto Sartori alberto.sartori at sissa.it
Mon Oct 28 15:07:17 UTC 2019


Dear All,
I would like to use build2 to build some executables for a course of
C++. I have several source files (each one with a main) and I would like
to compile a couple of them with a couple of more flags with respect to
the others. How can I do that?

Thanks,
Alberto Sartori

here are the files that I have written

$ cat build/bootstrap.build
project = lect4

using config

$ cat build/root.build
cxx.std = 14

using cxx

cxx{*}: extension = cc

cxx.coptions=-O3
cxx.poptions=-Wall -Wextra

$ cat buildfile

src = 01_enum.cc	\
02_scoped_enum.cc	\
03_namespace.cc		\
04_why_scoped.cc	\
05_struct_class.cc	\
06_constructor_destructor.cc	\
07_template_class.cc

for s : $src
{
  n = $name($s)
  ./: exe{$n".x"} : cxx{$n}
}

-- 

Alberto Sartori, Ph.D.

Master in High Performance Computing,
www.mhpc.it

SISSA, International School for Advanced Studies
via Bonomea 265, 34136 Trieste, Italy



More information about the users mailing list