Makefile to depend on third-party libs with cmake -
all.
my main program uses third-party library a. main program uses autoconf , library uses cmakefile build. since converting 1 framework pain me, want keep 2 different build mechanism.
since main
depends on liba
, made main
depend on liba
, liba
force-build target.
when change source file of main
, make
on main
, liba
gets cmake
, keep intact since nothing on liba
changed, main
gets build.
when change source file in liba
, make
on main
, liba
gets build forcefuly. main
's dependency liba
computed before building new liba
, linking not done. make twice each time main safely.
how can improve build? summarize:
main
depends onliba
(a)- when
make
after changing source file ofliba
, want buildliba
first , buildmain
(b) - when
make
after changing source file ofmain
, want buildmain
original liba (c) - when
make
without doing anything, want build nothing. (d)
with current setup, cannot (b).
any helps appreciated.
what old shell script (or bat file, if happen on windows)? run cmake liba, run make main, profit!
you can use make batch engine, e.g.
all: cmake liba $(make) -f main.mk main
Comments
Post a Comment