Autotools:将项目的一部分切换到不同的编译器

发布于 2024-11-14 07:33:29 字数 167 浏览 4 评论 0原文

我正在开发一个使用自动工具的大型旧项目。我想将项目的一部分切换到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

埖埖迣鎅 2024-11-21 07:33:29

您必须在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.

煮酒 2024-11-21 07:33:29

在你的源根目录中,你必须有一个包含所有编译器选项的configure.ac和Makefile.am。因此,您可以使用新的configure.ac和Makefile.am以及其他选项创建一个子目录。

你只需要在父configure.ac中添加这一行

AC_CONFIG_SUBDIRS([subdir_name])

,并在父Makefile.am中添加新的子目录

SUBDIRS= subdir_name

希望能有所帮助。

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

AC_CONFIG_SUBDIRS([subdir_name])

And add the new subdirectory in the parent Makefile.am

SUBDIRS= subdir_name

Hope can help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文