开发者

How do I set cmake output as a dependency to make?

Summary:

I am using an open source project which uses 'make' internally. I find it extremely complicated to use, so I want to use 'cmake' for my own code while the existing open source project code remains managed by make.

Problem:

However I can't find any way to invoke my 'cmake' build scrip开发者_运维知识库t from within 'make' and have the 'cmake' output (which is a .so library) as a dependency to the 'make' build. I read large parts of the manual and looked through many online tutorials on 'make' with no luck.

Further info:

My own code is written in C++ and therefore my 'cmake' script has two branches: Either it creates an executable, or if a variable is set, it creates a library. It will be necessary to pass a command line argument to the 'cmake' script from within 'make'.

I hope you can help!


If I understand your question correctly, this is how to do it. The default target of the makefile will (probably) be the first target, with a rule like this:

all: maybe-some-preqs
    do-some-things

Change it to this:

all: maybe-some-preqs libraryName.so
    do-some-things

libraryName.so:
    command-that-runs-cmake-just-as-if-you-were-doing-it-from-the-command-line
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜