Chul-Woong Yang
Chul-Woong Yang

Reputation: 1243

Makefile to depend on third-party libs with cmake

all.

My main program uses third-party library A. The main program uses autoconf and the library A uses cmakefile to build. Since converting one framework to another is pain to me, I want to keep two different build mechanism.

Since the main depends on libA, I made main to depend on libA and libA as force-build target.

When I change a source file of main and do make on main, libA gets cmake and keep intact since nothing on libA is changed, then only main gets build.

When I change a source file in libA and do make on main, libA gets build forcefuly. But main's dependency to libA is computed before building new libA, linking does not get done. Now I do make twice each time to get main safely.

How can I improve this build? To summarize:

With current setup, I cannot get (B).

Any helps will be deeply appreciated.

Upvotes: 0

Views: 107

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57203

What about good old shell script (or bat file, if you happen to be on Windows)? Run cmake for libA, run make for main, profit!

You can use make as your batch engine, e.g.

all:
        Cmake libA
        $(MAKE) -f main.mk main

Upvotes: 1

Related Questions