Autotools:将项目的一部分切换到不同的编译器
我正在开发一个使用自动工具的大型旧项目。我想将项目的一部分切换到 C++(从 C)。
如何切换项目的一部分使用的编译器?我不喜欢将项目完全分成两部分的想法。该目录只有 Makefile.am
,我想我应该以某种方式在 configure.ac
中注册它。
I'm working on a big, old, project that is using autotools. I would like to switch one part of the project to C++ (from C).
How can I switch the compiler used for a part of the project? I don't like the idea of completely splitting the project into two parts. The directory has only Makefile.am
and I suppose I should register this somehow in configure.ac
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在configure.ac中定义输出变量CXX(最简单的方法是使用AC_PROG_CXX宏),然后所有具有适当后缀(.cc、.cpp)的文件将由C++编译器编译。
You must define output variable CXX in configure.ac (the simplest way is by using AC_PROG_CXX macro), then all files with appropriate suffixes (.cc, .cpp) will be compiled by C++ compiler.
在你的源根目录中,你必须有一个包含所有编译器选项的configure.ac和Makefile.am。因此,您可以使用新的configure.ac和Makefile.am以及其他选项创建一个子目录。
你只需要在父configure.ac中添加这一行
,并在父Makefile.am中添加新的子目录
希望能有所帮助。
In your source root, you mut have a configure.ac and Makefile.am with all the compiler options. So, you can create a subdirectory with a new configure.ac and Makefile.am with other options.
You only need to add this line in the parent configure.ac
And add the new subdirectory in the parent Makefile.am
Hope can help.