Basics of Programming Language

Basics of Programming Language

Initially, I was confused between the terms build and compile. Today, I understood the exact meaning of it.

Compiling is the act of turning source code into object code or it simply converts cpp files to .0(object) files.

Linking is the act of combining object code with libraries into a raw executable.

Building is the sequence composed of compiling, linking and execute the code

Execute
The executable is loaded from the disk to memory and the computer’s processing unit (Central Processing Unit) executes the program one instruction at a time.

For learning cmake you should know the meaning of above terms. So if not got yet read it again. I am waiting.

Done?  Now let’s move to the preamble part of cmake.

What is cmake?

cmake means cross-platform make.

cmake takes information on how to build programs generates makefiles that build the program. Hence cmake is a language with abstract build rules and gnu make is a dependency resolves that executes programs on a directed acyclic graph traversal

Therefore whenever you’re writing cmake files, you have to think whether a command should apply during generation time, or during build time not same case in make. Think it Why?  You may reply to me also;)

CMake is a language(for generator of build systems) with abstract build rules and gnu make is a dependency resolves that executes programs on a directed acyclic graph traversal.

CMake itself also provides some nice features like dependency detection, library interface management, or integration with CTest, CDash and CPack.

Installation

sudo apt-get install cmake

Done. Very easy installation.

Few Commands

cmake <source_directory>

The above command basically setup your build environment. This creates a makefile  depending on the build system of your choice. The build system can be passed to CMake as a parameter. However, CMake makes reasonable default choices depending on your system configuration. Second, you perform the actual build in the selected build system.”

set(<variable> <value1> ... <valueN>)

set command set the variable with the given  values.

Reference:-

pdf on cmake

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s