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 of makefile, In the Gdal source root directory can be found MAKEFILE.VC and gnumakefile two makefile files, which makefile.vc for the VC compiler makefile,gnumakefile for the GNU GCC compiler makefile.

Another way is to use the CMake software. CMake software can be thought of as the source code to build each IDE manufacturer's engineering format. CMake is an open source software that CMake supported by some Ides (compilers) such as:

As you can see, CMake can support many Ides. The output directory of the CMake software is used as the CMake folder in the root directory of 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 can I tell which way an open source code supports? A superficial way is to look at the source root directory to see if there is a file named makefile, if there is, it is likely to support makefile compiled, if the source root directory has CMakeLists.txt, should be supported CMake way to compile.

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

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.