带子目录的 OMake 编译
查看 OMake 文档,似乎每当使用子目录中的源时 - 它们总是首先编译成静态库。 这总是必要的吗? 我可以在不构建库的情况下编译和链接所有内容吗? 我一直在尝试为此编写 OMakefiles 但没有成功。
示例目录结构:
myproject: OMakeroot, OMakefile, main.cpp
myproject/headers: file1.h
myproject/src: file1.cpp
myproject OMakeroot 内容:
open build/C
。子目录: .
myproject Omakefile 内容:
CXX = g++
CXXFLAGS = -Wall
INCLUDES += headers src
CXXProgram(myapp, main file1 )
headers 和 src 目录中的 OMakefiles 为空,不确定其中是否需要任何内容。
当我运行 omake myapp 时,出现错误:
不知道如何构建“myapp”所需的“file1.o”
Looking through OMake documentation it seems whenever sources from subdirectories are used - they are always compiled into static libraries first. Is this always necessary? Can I compile and link everything without building the libs? I've been trying to write OMakefiles for this but with no success.
Example dir structure:
myproject: OMakeroot, OMakefile, main.cpp
myproject/headers: file1.h
myproject/src: file1.cpp
myproject OMakeroot contents:
open build/C
.SUBDIRS: .
myproject Omakefile contents:
CXX = g++
CXXFLAGS = -Wall
INCLUDES += headers src
CXXProgram(myapp, main file1 )
OMakefiles in headers and src directories are empty, not sure if anything needs to be in them.
When I run omake myapp I get an error:
Do not know how to build "file1.o" required for "myapp"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了将来参考,以防线程消失,这里是 Maxicat 引用的线程上发布的解决方案(经过重新措辞以仅显示解决方案)。
For future reference, in case the thread disappears, here is the solution posted on the thread that Maxicat refers to (reworded to show just the solution).
尝试
src/file1
,以便 omake 知道它需要构建src/file1.o
而不是file1.o
,因此需要 < code>src/file1.cpp 而不是file1.cpp
(它不存在)。Try
src/file1
, so that omake knows that it needs to buildsrc/file1.o
instead offile1.o
, and therefore needssrc/file1.cpp
instead offile1.cpp
(which doesn't exist).在 Omake 邮件列表上解决了这个问题,为了完整性,这里的线程链接: http://lists.metaprl.org/pipermail/omake/2009-July/002094.html
Got this resolved on the Omake mailing list, thread link here just for completeness: http://lists.metaprl.org/pipermail/omake/2009-July/002094.html