CMake如何选择gcc和g ++进行编译? [英] How does CMake choose gcc and g++ for compiling?
问题描述
我是CMake的新手,我想知道一个C ++ / C项目在LINUX环境如何CMake可以选择gcc和g ++之间的编译器。更具体地说,我的问题如下:
- 如果项目由.c和.cpp文件组成, $ b .c文件将由gcc编译,而.cpp文件将由g ++编译
? - 如果项目只有c文件或cpp文件, default
CMake的编译操作?是否可以更改?
>
你可以用几乎所有的东西。有一些标志和变量绑定到语言的扩展;然后将语言定义为定义工具集和构建目标的编译器选项/可执行文件。
检查以下文档链接。
注意:维基可能已过时,但在重要和教育问题。
PS。有很多相关的选项。对于更长的阅读,您可以查看以下文档部分:源文件上的属性和语言的变量。 2.和3.来自这些部分。
I am newbie of CMake, and I was wondering for a C++/C project in the LINUX environmental how CMake can choose compilers between gcc and g++. More specifically, my questions are as follows:
- If a project is consisted of .c and .cpp file, is it true that the .c files will be compiled by gcc while the .cpp files will be compiled by g++?
- If a project has only c files or cpp files, what's the default compiling operation for CMake? Will it be possible to change it?
Shortly, yes to both.
You can mangle with pretty much everything. There are flags and variables that bind extensions to language; and then language to compiler options/executables that define toolsets and build targets.
Check following links to documentation. Those are some pleasant short readings.
Note: The wiki might be outdated but it should hold in case of important and educational matter.
PS. There is whole bunch of related options. For some longer read you can check following sections of documentation: Properties on Source Files and Variables for Languages. 2. and 3. come from these sections.
这篇关于CMake如何选择gcc和g ++进行编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!