Two common ways to compile cross-platform C + + open source code

Source: Internet
Author: User

Zhu Jinchan

Source: http://blog.csdn.net/clever101

Cross-platform C + + open source code to adapt to the compilation of a variety of compilers, the use of two ways to fit. One is the makefile way. Taking the famous Spatial data format parsing library Gdal as an example, it provides the makefile to compile for various compilers.

Gdal mainly provides the Microsoft VC compiler and the GNU GCC compiler in two formats makefile, Gdal source root folder can find Makefile.vc and gnumakefile two makefile files. Among them, MAKEFILE.VC is the VC compiler's makefile,gnumakefile for the GNU GCC compiler makefile.

Another way is to use the CMake software. CMake software can be seen as a project format for building individual IDE vendors based on source code.

CMake is an open source software that CMake supported by some Ides (compilers) such as:

From being able to see that cmake can support very many Ides.

The output folder of the CMake software is accustomed to the CMake folder under the root folder of the open source code.

Cross-platform C + + Open source code generally supports at least makefile or CMake way to compile, and in some cases both are supported.

How do you infer which way an open source code supports? A superficial way is to see if the source root folder has a file named Makefile, fake, very likely to support makefile compiled, assuming that the source code root folder has CMakeLists.txt, should be supported CMake way to compile.

Two common ways to compile cross-platform C + + open source code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.