[英]Mixing C++98 and C++11 source in automake/gcc
I have a list of cpp files in project which is built using automake tools. 我在使用自动制作工具构建的项目中有一个cpp文件列表。
Some of them are written using pre-C++11 standard (ie C++98) and they cannot compile with c++11 flag of gcc (-std=c++11). 其中一些是使用C ++ 11之前的标准(即C ++ 98)编写的,无法使用gcc的c ++ 11标志(-std = c ++ 11)进行编译。
Latest cpp files are using C++11 standard and they need -std=c++11 flag in compile. 最新的cpp文件正在使用C ++ 11标准,并且在编译时需要-std = c ++ 11标志。
Can I define in Automake two lists of cpp source files and give different compilation flags? 我可以在Automake中定义两个cpp源文件列表并给出不同的编译标志吗?
This is ripped directly from Setting per-file flags with automake 这直接从使用automake设置每个文件的标志中删除
You may bundle your c++11 code into a lib and provide different flags for this code subset in Makefile.am 您可以将c ++ 11代码捆绑到一个lib中,并在Makefile.am中为此代码子集提供不同的标志。
bin_PROGRAMS = test
test_SOURCES = main.cpp
test_LDADD = c11code.la
noinst_LTLIBRARIES = c11code.la
c11code_la_SOURCES = cxx1_1.cpp cxx1_2.cpp cxx1_3.cpp
c11code_la_CXXFLAGS = $(CXXFLAGS) -std=c++11
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.