[英]cmakelists.txt - combine with existing Makefiles
Im new to CMakeLists.txt and it's syntax so Im hoping this is pretty easy. 我是CMakeLists.txt的新手,它的语法很好,我希望这很容易。
Project has two subdirectories: A and B Project有两个子目录:A和B.
A requires files from B A需要来自B的文件
B has a CMakeLists.txt already. B已经有一个CMakeLists.txt 。
A just has a Makefile . 一个只有一个Makefile 。 A doesn't build an executable;
A不构建可执行文件; just a .o for another separate project(this folder is part of a larger build).
只是一个.o用于另一个单独的项目(此文件夹是更大版本的一部分)。
Ive create a CMakeLists.txt in the parent folder but I can't figure out how to call the make in folder A. 我在父文件夹中创建了一个CMakeLists.txt ,但我无法弄清楚如何在文件夹A中调用make 。
cmake_minimum_required (VERSION 3.2.3)
project(PARSER)
add_subdirectory(B)
add_custom_target(a-sub
COMMAND "make"
WORKING_DIRECTORY "./A")
When I build this it runs the make in folder B but does nothing to folder A. 当我构建它时,它在文件夹B中运行make,但对文件夹A没有任何作用。
Suggestions on how to proceed? 关于如何进行的建议?
Initially I tried to rewrite the existing (folder A) Makefile into a CMakeLists.txt but didn't get v far. 最初我尝试将现有的(文件夹A) Makefile重写为CMakeLists.txt,但没有得到v。 This syntax is a bit tricky.
这种语法有点棘手。
I don't think mixing make and cmake is a good idea. 我不认为混合make和cmake是个好主意。 If you can't convert A to use cmake then I'd suggest making A and separate projects.
如果你不能转换A来使用cmake那么我建议制作A和单独的项目。 Use cmake for B and install the headers and the libraries somewhere.
使用cmake for B并在某处安装标头和库。 Then use a makefile for A and point it to where B is installed.
然后对A使用makefile并将其指向安装B的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.