-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild-systems.html
More file actions
175 lines (142 loc) · 49.3 KB
/
build-systems.html
File metadata and controls
175 lines (142 loc) · 49.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>C++ | Build Systems</title>
<meta name="generator" content="VuePress 1.8.2">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="description" content="Generating Build Environment with CMake, Compiling with GNU make, Building with SCons, Autotools (GNU), Ninja, NMAKE (Microsoft Program Maintenance Utility)">
<meta property="og:site_name" content="DevTut">
<meta property="og:title" content="C++ | Build Systems">
<meta property="og:description" content="Generating Build Environment with CMake, Compiling with GNU make, Building with SCons, Autotools (GNU), Ninja, NMAKE (Microsoft Program Maintenance Utility)">
<meta property="og:type" content="article">
<meta property="og:url" content="/cpp/build-systems.html">
<meta property="og:image" content="/logo.png">
<meta name="twitter:title" content="C++ | Build Systems">
<meta name="twitter:description" content="Generating Build Environment with CMake, Compiling with GNU make, Building with SCons, Autotools (GNU), Ninja, NMAKE (Microsoft Program Maintenance Utility)">
<meta name="twitter:url" content="/cpp/build-systems.html">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="/logo.png">
<meta name="theme-color" content="#ffffff">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="msapplication-TileImage" content="/mstile-150x150.png">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="google-site-verification" content="76_rKXgwMVIjd-axJC_1zPV9OS4mEjvtgjYOWVkAdnQ">
<link rel="preload" href="/assets/css/0.styles.60619e34.css" as="style"><link rel="preload" href="/assets/js/app.1779e102.js" as="script"><link rel="preload" href="/assets/js/3.2cfa8016.js" as="script"><link rel="preload" href="/assets/js/622.78d8ff95.js" as="script">
<link rel="stylesheet" href="/assets/css/0.styles.60619e34.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">DevTut</span></a> <div class="links"><form id="search-form" role="search" class="algolia-search-wrapper search-box"><input id="algolia-search-input" class="search-query"></form> <nav class="nav-links can-hide"> <a href="https://github.com/devtut/generate" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"> <a href="https://github.com/devtut/generate" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>C++</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/cpp/" aria-current="page" class="sidebar-link">Disclaimer</a></li><li><a href="/cpp/getting-started-with-cpp.html" class="sidebar-link">Getting started with C++</a></li><li><a href="/cpp/literals.html" class="sidebar-link">Literals</a></li><li><a href="/cpp/operator-precedence.html" class="sidebar-link">operator precedence</a></li><li><a href="/cpp/floating-point-arithmetic.html" class="sidebar-link">Floating Point Arithmetic</a></li><li><a href="/cpp/bit-operators.html" class="sidebar-link">Bit Operators</a></li><li><a href="/cpp/bit-manipulation.html" class="sidebar-link">Bit Manipulation</a></li><li><a href="/cpp/bit-fields.html" class="sidebar-link">Bit fields</a></li><li><a href="/cpp/arrays.html" class="sidebar-link">Arrays</a></li><li><a href="/cpp/iterators.html" class="sidebar-link">Iterators</a></li><li><a href="/cpp/basic-input-output-in-c.html" class="sidebar-link">Basic input/output in c++</a></li><li><a href="/cpp/loops.html" class="sidebar-link">Loops</a></li><li><a href="/cpp/file-i-o.html" class="sidebar-link">File I/O</a></li><li><a href="/cpp/cpp-streams.html" class="sidebar-link">C++ Streams</a></li><li><a href="/cpp/stream-manipulators.html" class="sidebar-link">Stream manipulators</a></li><li><a href="/cpp/flow-control.html" class="sidebar-link">Flow Control</a></li><li><a href="/cpp/metaprogramming.html" class="sidebar-link">Metaprogramming</a></li><li><a href="/cpp/const-keyword.html" class="sidebar-link">const keyword</a></li><li><a href="/cpp/mutable-keyword.html" class="sidebar-link">mutable keyword</a></li><li><a href="/cpp/friend-keyword.html" class="sidebar-link">Friend keyword</a></li><li><a href="/cpp/type-keywords.html" class="sidebar-link">Type Keywords</a></li><li><a href="/cpp/basic-type-keywords.html" class="sidebar-link">Basic Type Keywords</a></li><li><a href="/cpp/variable-declaration-keywords.html" class="sidebar-link">Variable Declaration Keywords</a></li><li><a href="/cpp/keywords.html" class="sidebar-link">Keywords</a></li><li><a href="/cpp/returning-several-values-from-a-function.html" class="sidebar-link">Returning several values from a function</a></li><li><a href="/cpp/polymorphism.html" class="sidebar-link">Polymorphism</a></li><li><a href="/cpp/references.html" class="sidebar-link">References</a></li><li><a href="/cpp/value-and-reference-semantics.html" class="sidebar-link">Value and Reference Semantics</a></li><li><a href="/cpp/c-function-call-by-value-vs-call-by-reference.html" class="sidebar-link">C++ function "call by value" vs. "call by reference"</a></li><li><a href="/cpp/copying-vs-assignment.html" class="sidebar-link">Copying vs Assignment</a></li><li><a href="/cpp/pointers.html" class="sidebar-link">Pointers</a></li><li><a href="/cpp/pointers-to-members.html" class="sidebar-link">Pointers to members</a></li><li><a href="/cpp/the-this-pointer.html" class="sidebar-link">The This Pointer</a></li><li><a href="/cpp/smart-pointers.html" class="sidebar-link">Smart Pointers</a></li><li><a href="/cpp/classes-structures.html" class="sidebar-link">Classes/Structures</a></li><li><a href="/cpp/function-overloading.html" class="sidebar-link">Function Overloading</a></li><li><a href="/cpp/operator-overloading.html" class="sidebar-link">Operator Overloading</a></li><li><a href="/cpp/function-template-overloading.html" class="sidebar-link">Function Template Overloading</a></li><li><a href="/cpp/virtual-member-functions.html" class="sidebar-link">Virtual Member Functions</a></li><li><a href="/cpp/inline-functions.html" class="sidebar-link">Inline functions</a></li><li><a href="/cpp/special-member-functions.html" class="sidebar-link">Special Member Functions</a></li><li><a href="/cpp/non-static-member-functions.html" class="sidebar-link">Non-Static Member Functions</a></li><li><a href="/cpp/constant-class-member-functions.html" class="sidebar-link">Constant class member functions</a></li><li><a href="/cpp/c-containers.html" class="sidebar-link">C++ Containers</a></li><li><a href="/cpp/namespaces.html" class="sidebar-link">Namespaces</a></li><li><a href="/cpp/header-files.html" class="sidebar-link">Header Files</a></li><li><a href="/cpp/using-declaration.html" class="sidebar-link">Using declaration</a></li><li><a href="/cpp/std-string.html" class="sidebar-link">std::string</a></li><li><a href="/cpp/std-array.html" class="sidebar-link">std::array</a></li><li><a href="/cpp/std-vector.html" class="sidebar-link">std::vector</a></li><li><a href="/cpp/std-map.html" class="sidebar-link">std::map</a></li><li><a href="/cpp/std-optional.html" class="sidebar-link">std::optional</a></li><li><a href="/cpp/std-function-to-wrap-any-element-that-is-callable.html" class="sidebar-link">std::function: To wrap any element that is callable</a></li><li><a href="/cpp/std-forward-list.html" class="sidebar-link">std::forward_list</a></li><li><a href="/cpp/std-pair.html" class="sidebar-link">std::pair</a></li><li><a href="/cpp/std-atomics.html" class="sidebar-link">std::atomics</a></li><li><a href="/cpp/std-variant.html" class="sidebar-link">std::variant</a></li><li><a href="/cpp/std-iomanip.html" class="sidebar-link">std::iomanip</a></li><li><a href="/cpp/std-any.html" class="sidebar-link">std::any</a></li><li><a href="/cpp/std-set-and-std-multiset.html" class="sidebar-link">std::set and std::multiset</a></li><li><a href="/cpp/std-integer-sequence.html" class="sidebar-link">std::integer_sequence</a></li><li><a href="/cpp/using-std-unordered-map.html" class="sidebar-link">Using std::unordered_map</a></li><li><a href="/cpp/standard-library-algorithms.html" class="sidebar-link">Standard Library Algorithms</a></li><li><a href="/cpp/the-iso-c-standard.html" class="sidebar-link">The ISO C++ Standard</a></li><li><a href="/cpp/inline-variables.html" class="sidebar-link">Inline variables</a></li><li><a href="/cpp/random-number-generation.html" class="sidebar-link">Random number generation</a></li><li><a href="/cpp/date-and-time-using-chrono-header.html" class="sidebar-link">Date and time using header</a></li><li><a href="/cpp/sorting.html" class="sidebar-link">Sorting</a></li><li><a href="/cpp/enumeration.html" class="sidebar-link">Enumeration</a></li><li><a href="/cpp/iteration.html" class="sidebar-link">Iteration</a></li><li><a href="/cpp/regular-expressions.html" class="sidebar-link">Regular expressions</a></li><li><a href="/cpp/implementation-defined-behavior.html" class="sidebar-link">Implementation-defined behavior</a></li><li><a href="/cpp/exceptions.html" class="sidebar-link">Exceptions</a></li><li><a href="/cpp/lambdas.html" class="sidebar-link">Lambdas</a></li><li><a href="/cpp/value-categories.html" class="sidebar-link">Value Categories</a></li><li><a href="/cpp/preprocessor.html" class="sidebar-link">Preprocessor</a></li><li><a href="/cpp/data-structures-in-c.html" class="sidebar-link">Data Structures in C++</a></li><li><a href="/cpp/templates.html" class="sidebar-link">Templates</a></li><li><a href="/cpp/expression-templates.html" class="sidebar-link">Expression templates</a></li><li><a href="/cpp/curiously-recurring-template-pattern-crtp.html" class="sidebar-link">Curiously Recurring Template Pattern (CRTP)</a></li><li><a href="/cpp/threading.html" class="sidebar-link">Threading</a></li><li><a href="/cpp/thread-synchronization-structures.html" class="sidebar-link">Thread synchronization structures</a></li><li><a href="/cpp/the-rule-of-three-five-and-zero.html" class="sidebar-link">The Rule of Three, Five, And Zero</a></li><li><a href="/cpp/raii-resource-acquisition-is-initialization.html" class="sidebar-link">RAII: Resource Acquisition Is Initialization</a></li><li><a href="/cpp/rtti-run-time-type-information.html" class="sidebar-link">RTTI: Run-Time Type Information</a></li><li><a href="/cpp/mutexes.html" class="sidebar-link">Mutexes</a></li><li><a href="/cpp/recursive-mutex.html" class="sidebar-link">Recursive Mutex</a></li><li><a href="/cpp/semaphore.html" class="sidebar-link">Semaphore</a></li><li><a href="/cpp/futures-and-promises.html" class="sidebar-link">Futures and Promises</a></li><li><a href="/cpp/atomic-types.html" class="sidebar-link">Atomic Types</a></li><li><a href="/cpp/type-erasure.html" class="sidebar-link">Type Erasure</a></li><li><a href="/cpp/explicit-type-conversions.html" class="sidebar-link">Explicit type conversions</a></li><li><a href="/cpp/unnamed-types.html" class="sidebar-link">Unnamed types</a></li><li><a href="/cpp/type-traits.html" class="sidebar-link">Type Traits</a></li><li><a href="/cpp/return-type-covariance.html" class="sidebar-link">Return Type Covariance</a></li><li><a href="/cpp/layout-of-object-types.html" class="sidebar-link">Layout of object types</a></li><li><a href="/cpp/type-inference.html" class="sidebar-link">Type Inference</a></li><li><a href="/cpp/typedef-and-type-aliases.html" class="sidebar-link">Typedef and type aliases</a></li><li><a href="/cpp/type-deduction.html" class="sidebar-link">type deduction</a></li><li><a href="/cpp/trailing-return-type.html" class="sidebar-link">Trailing return type</a></li><li><a href="/cpp/alignment.html" class="sidebar-link">Alignment</a></li><li><a href="/cpp/perfect-forwarding.html" class="sidebar-link">Perfect Forwarding</a></li><li><a href="/cpp/decltype.html" class="sidebar-link">decltype</a></li><li><a href="/cpp/sfinae-substitution-failure-is-not-an-error.html" class="sidebar-link">SFINAE (Substitution Failure Is Not An Error)</a></li><li><a href="/cpp/undefined-behavior.html" class="sidebar-link">Undefined Behavior</a></li><li><a href="/cpp/overload-resolution.html" class="sidebar-link">Overload resolution</a></li><li><a href="/cpp/move-semantics.html" class="sidebar-link">Move Semantics</a></li><li><a href="/cpp/pimpl-idiom.html" class="sidebar-link">Pimpl Idiom</a></li><li><a href="/cpp/auto.html" class="sidebar-link">auto</a></li><li><a href="/cpp/copy-elision.html" class="sidebar-link">Copy Elision</a></li><li><a href="/cpp/fold-expressions.html" class="sidebar-link">Fold Expressions</a></li><li><a href="/cpp/unions.html" class="sidebar-link">Unions</a></li><li><a href="/cpp/design-pattern-implementation-in-c.html" class="sidebar-link">Design pattern implementation in C++</a></li><li><a href="/cpp/singleton-design-pattern.html" class="sidebar-link">Singleton Design Pattern</a></li><li><a href="/cpp/user-defined-literals.html" class="sidebar-link">User-Defined Literals</a></li><li><a href="/cpp/memory-management.html" class="sidebar-link">Memory management</a></li><li><a href="/cpp/c-11-memory-model.html" class="sidebar-link">C++11 Memory Model</a></li><li><a href="/cpp/scopes.html" class="sidebar-link">Scopes</a></li><li><a href="/cpp/static-assert.html" class="sidebar-link">static_assert</a></li><li><a href="/cpp/constexpr.html" class="sidebar-link">constexpr</a></li><li><a href="/cpp/one-definition-rule-odr.html" class="sidebar-link">One Definition Rule (ODR)</a></li><li><a href="/cpp/unspecified-behavior.html" class="sidebar-link">Unspecified behavior</a></li><li><a href="/cpp/argument-dependent-name-lookup.html" class="sidebar-link">Argument Dependent Name Lookup</a></li><li><a href="/cpp/attributes.html" class="sidebar-link">Attributes</a></li><li><a href="/cpp/recursion-in-c.html" class="sidebar-link">Recursion in C++</a></li><li><a href="/cpp/arithmitic-metaprogramming.html" class="sidebar-link">Arithmitic Metaprogramming</a></li><li><a href="/cpp/callable-objects.html" class="sidebar-link">Callable Objects</a></li><li><a href="/cpp/client-server-examples.html" class="sidebar-link">Client server examples</a></li><li><a href="/cpp/const-correctness.html" class="sidebar-link">Const Correctness</a></li><li><a href="/cpp/parameter-packs.html" class="sidebar-link">Parameter packs</a></li><li><a href="/cpp/build-systems.html" aria-current="page" class="active sidebar-link">Build Systems</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#generating-build-environment-with-cmake" class="sidebar-link">Generating Build Environment with CMake</a></li><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#compiling-with-gnu-make" class="sidebar-link">Compiling with GNU make</a></li><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#building-with-scons" class="sidebar-link">Building with SCons</a></li><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#autotools-gnu" class="sidebar-link">Autotools (GNU)</a></li><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#ninja" class="sidebar-link">Ninja</a></li><li class="sidebar-sub-header"><a href="/cpp/build-systems.html#nmake-microsoft-program-maintenance-utility" class="sidebar-link">NMAKE (Microsoft Program Maintenance Utility)</a></li></ul></li><li><a href="/cpp/concurrency-with-openmp.html" class="sidebar-link">Concurrency With OpenMP</a></li><li><a href="/cpp/resource-management.html" class="sidebar-link">Resource Management</a></li><li><a href="/cpp/storage-class-specifiers.html" class="sidebar-link">Storage class specifiers</a></li><li><a href="/cpp/linkage-specifications.html" class="sidebar-link">Linkage specifications</a></li><li><a href="/cpp/digit-separators.html" class="sidebar-link">Digit separators</a></li><li><a href="/cpp/c-incompatibilities.html" class="sidebar-link">C incompatibilities</a></li><li><a href="/cpp/side-by-side-comparisons-of-classic-c-examples-solved-via-c-vs-c-11-vs-c-14-vs-c-17.html" class="sidebar-link">Side by Side Comparisons of classic C++ examples solved via C++ vs C++11 vs C++14 vs C++17</a></li><li><a href="/cpp/compiling-and-building.html" class="sidebar-link">Compiling and Building</a></li><li><a href="/cpp/common-compile-linker-errors-gcc.html" class="sidebar-link">Common compile/linker errors (GCC)</a></li><li><a href="/cpp/more-undefined-behaviors-in-c.html" class="sidebar-link">More undefined behaviors in C++</a></li><li><a href="/cpp/unit-testing-in-c.html" class="sidebar-link">Unit Testing in C++</a></li><li><a href="/cpp/c-debugging-and-debug-prevention-tools-techniques.html" class="sidebar-link">C++ Debugging and Debug-prevention Tools & Techniques</a></li><li><a href="/cpp/optimization-in-c.html" class="sidebar-link">Optimization in C++</a></li><li><a href="/cpp/optimization.html" class="sidebar-link">Optimization</a></li><li><a href="/cpp/profiling.html" class="sidebar-link">Profiling</a></li><li><a href="/cpp/refactoring-techniques.html" class="sidebar-link">Refactoring Techniques</a></li><li><a href="/cpp/internationalization-in-c.html" class="sidebar-link">Internationalization in C++</a></li><li><a href="/cpp/contributors.html" class="sidebar-link">The Contributors</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="build-systems"><a href="#build-systems" class="header-anchor">#</a> Build Systems</h1> <h2 id="generating-build-environment-with-cmake"><a href="#generating-build-environment-with-cmake" class="header-anchor">#</a> Generating Build Environment with CMake</h2> <p><a href="https://cmake.org/" target="_blank" rel="noopener noreferrer">CMake<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> generates build environments for nearly any compiler or IDE from a single project definition. The following examples will demonstrate how to add a CMake file to the <a href="http://stackoverflow.com/documentation/c%2B%2B/206/introduction-to-c/774/hello-world" target="_blank" rel="noopener noreferrer">cross-platform "Hello World" C++ code<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <p>CMake files are always named "CMakeLists.txt" and should already exist in every project's root directory (and possibly in sub-directories too.) A basic CMakeLists.txt file looks like:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token function">cmake_minimum_required</span><span class="token punctuation">(</span>VERSION <span class="token number">2.4</span><span class="token punctuation">)</span>
<span class="token function">project</span><span class="token punctuation">(</span>HelloWorld<span class="token punctuation">)</span>
<span class="token function">add_executable</span><span class="token punctuation">(</span>HelloWorld main<span class="token punctuation">.</span>cpp<span class="token punctuation">)</span>
</code></pre></div><p>See it <a href="http://coliru.stacked-crooked.com/a/616a0939bdd91b8b" target="_blank" rel="noopener noreferrer">live on Coliru<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <p>This file tells CMake the project name, what file version to expect, and instructions to generate an executable called "HelloWorld" that requires <code>main.cpp</code>.</p> <p>Generate a build environment for your installed compiler/IDE from the command line:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token operator">></span> cmake <span class="token punctuation">.</span>
</code></pre></div><p>Build the application with:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token operator">></span> cmake <span class="token operator">--</span>build <span class="token punctuation">.</span>
</code></pre></div><p>This generates the default build environment for the system, depending on the OS and installed tools. Keep source code clean from any build artifacts with use of "out-of-source" builds:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token operator">></span> mkdir build
<span class="token operator">></span> cd build
<span class="token operator">></span> cmake <span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token operator">></span> cmake <span class="token operator">--</span>build <span class="token punctuation">.</span>
</code></pre></div><p>CMake can also abstract the platform shell's basic commands from the previous example:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token operator">></span> cmake <span class="token operator">-</span>E make_directory build
<span class="token operator">></span> cmake <span class="token operator">-</span>E chdir build cmake <span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token operator">></span> cmake <span class="token operator">--</span>build build
</code></pre></div><p>CMake includes <a href="https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html" target="_blank" rel="noopener noreferrer">generators<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for a number of common build tools and IDEs. To generate makefiles for <a href="https://msdn.microsoft.com/en-us/library/dd9y37ha.aspx" target="_blank" rel="noopener noreferrer">Visual Studio's <code>nmake</code><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token operator">></span> cmake <span class="token operator">-</span>G <span class="token string">"NMake Makefiles"</span> <span class="token punctuation">.</span><span class="token punctuation">.</span>
<span class="token operator">></span> nmake
</code></pre></div><h2 id="compiling-with-gnu-make"><a href="#compiling-with-gnu-make" class="header-anchor">#</a> Compiling with GNU make</h2> <h3 id="introduction"><a href="#introduction" class="header-anchor">#</a> Introduction</h3> <p>The GNU Make (styled <code>make</code>) is a program dedicated to the automation of executing shell commands. GNU Make is one specific program that falls under the Make family. Make remains popular among Unix-like and POSIX-like operating systems, including those derived from the Linux kernel, Mac OS X, and BSD.</p> <p>GNU Make is especially notable for being attached to the GNU Project, which is attached to the popular GNU/Linux operating system. GNU Make also has compatible versions running on various flavors of Windows and Mac OS X. It is also a very stable version with historical significance that remains popular. It is for these reasons that GNU Make is often taught alongside C and C++.</p> <h3 id="basic-rules"><a href="#basic-rules" class="header-anchor">#</a> Basic rules</h3> <p>To compile with make, create a Makefile in your project directory. Your Makefile could be as simple as:</p> <p><strong>Makefile</strong></p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">Set some variables to use in our command</span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">First<span class="token punctuation">,</span> we set the compiler to be g<span class="token operator">++</span></span></span>
CXX<span class="token operator">=</span>g<span class="token operator">++</span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">Then<span class="token punctuation">,</span> we say that we want to compile with g<span class="token operator">++</span>'s recommended warnings <span class="token operator">and</span> some extra ones<span class="token punctuation">.</span></span></span>
CXXFLAGS<span class="token operator">=</span><span class="token operator">-</span>Wall <span class="token operator">-</span>Wextra <span class="token operator">-</span>pedantic
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">This will be the output file</span></span>
EXE<span class="token operator">=</span>app
SRCS<span class="token operator">=</span>main<span class="token punctuation">.</span>cpp
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">When you call `make` at the command line<span class="token punctuation">,</span> <span class="token keyword">this</span> </span><span class="token string">"target"</span> <span class="token expression">is called<span class="token punctuation">.</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">The $<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span> at the right says that the `all` target depends on the `$<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span>` target<span class="token punctuation">.</span></span></span>
# $<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span> expands to be the content of the EXE variable
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">Note<span class="token operator">:</span> Because <span class="token keyword">this</span> is the first target<span class="token punctuation">,</span> it becomes the <span class="token keyword">default</span> target <span class="token keyword">if</span> `make` is called without target</span></span>
all<span class="token operator">:</span> $<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">This is equivalent to saying</span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token directive keyword">app</span><span class="token expression"><span class="token operator">:</span> $<span class="token punctuation">(</span>SRCS<span class="token punctuation">)</span></span></span>
# $<span class="token punctuation">(</span>SRCS<span class="token punctuation">)</span> can be separated<span class="token punctuation">,</span> which means that <span class="token keyword">this</span> target would depend on each file<span class="token punctuation">.</span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">Note that <span class="token keyword">this</span> target has a </span><span class="token string">"method body"</span><span class="token expression"><span class="token operator">:</span> the part indented by a <span class="token function">tab</span> <span class="token punctuation">(</span><span class="token operator">not</span> four spaces<span class="token punctuation">)</span><span class="token punctuation">.</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">When we build <span class="token keyword">this</span> target<span class="token punctuation">,</span> make will execute the command<span class="token punctuation">,</span> which is<span class="token operator">:</span></span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token directive keyword">g</span><span class="token expression"><span class="token operator">++</span> <span class="token operator">-</span>Wall <span class="token operator">-</span>Wextra <span class="token operator">-</span>pedantic <span class="token operator">-</span>o app main<span class="token punctuation">.</span>cpp</span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">I<span class="token punctuation">.</span>E<span class="token punctuation">.</span> Compile main<span class="token punctuation">.</span>cpp with warnings<span class="token punctuation">,</span> <span class="token operator">and</span> output to the file <span class="token punctuation">.</span><span class="token operator">/</span>app</span></span>
$<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span><span class="token operator">:</span> $<span class="token punctuation">(</span>SRCS<span class="token punctuation">)</span>
@$<span class="token punctuation">(</span>CXX<span class="token punctuation">)</span> $<span class="token punctuation">(</span>CXXFLAGS<span class="token punctuation">)</span> <span class="token operator">-</span>o $@ $<span class="token punctuation">(</span>SRCS<span class="token punctuation">)</span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token expression">This target should reverse the `all` target<span class="token punctuation">.</span> If you call</span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token directive keyword">make</span> <span class="token expression">with an argument<span class="token punctuation">,</span> like `make clean`<span class="token punctuation">,</span> the corresponding target</span></span>
<span class="token macro property"><span class="token directive-hash">#</span> <span class="token directive keyword">gets</span> <span class="token expression">called<span class="token punctuation">.</span></span></span>
clean<span class="token operator">:</span>
@rm <span class="token operator">-</span>f $<span class="token punctuation">(</span>EXE<span class="token punctuation">)</span>
</code></pre></div><blockquote></blockquote> <p><strong>NOTE: Make absolutely sure that the indentations are with a tab, not with four spaces. Otherwise, you'll get an error of</strong> <code>Makefile:10: *** missing separator. Stop.</code></p> <p>To run this from the command-line, do the following:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code>$ cd <span class="token operator">~</span><span class="token operator">/</span>Path<span class="token operator">/</span>to<span class="token operator">/</span>project
$ make
$ ls
app main<span class="token punctuation">.</span>cpp Makefile
$ <span class="token punctuation">.</span><span class="token operator">/</span>app
Hello World<span class="token operator">!</span>
$ make clean
$ ls
main<span class="token punctuation">.</span>cpp Makefile
</code></pre></div><h3 id="incremental-builds"><a href="#incremental-builds" class="header-anchor">#</a> Incremental builds</h3> <p>When you start having more files, make becomes more useful. What if you edited <strong>a.cpp</strong> but not <strong>b.cpp</strong>? Recompiling <strong>b.cpp</strong> would take more time.</p> <p>With the following directory structure:</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token punctuation">.</span>
<span class="token operator">+</span><span class="token operator">--</span> src
<span class="token operator">|</span> <span class="token operator">+</span><span class="token operator">--</span> a<span class="token punctuation">.</span>cpp
<span class="token operator">|</span> <span class="token operator">+</span><span class="token operator">--</span> a<span class="token punctuation">.</span>hpp
<span class="token operator">|</span> <span class="token operator">+</span><span class="token operator">--</span> b<span class="token punctuation">.</span>cpp
<span class="token operator">|</span> <span class="token operator">+</span><span class="token operator">--</span> b<span class="token punctuation">.</span>hpp
<span class="token operator">+</span><span class="token operator">--</span> Makefile
</code></pre></div><p>This would be a good Makefile:</p> <p><strong>Makefile</strong></p> <div class="language-cpp extra-class"><pre class="language-cpp"><code>CXX<span class="token operator">=</span>g<span class="token operator">++</span>
CXXFLAGS<span class="token operator">=</span><span class="token operator">-</span>Wall <span class="token operator">-</span>Wextra <span class="token operator">-</span>pedantic
EXE<span class="token operator">=</span>app
SRCS_GLOB<span class="token operator">=</span>src<span class="token comment">/*.cpp
SRCS=$(wildcard $(SRCS_GLOB))
OBJS=$(SRCS:.cpp=.o)
all: $(EXE)
$(EXE): $(OBJS)
@$(CXX) -o $@ $(OBJS)
depend: .depend
.depend: $(SRCS)
@-rm -f ./.depend
@$(CXX) $(CXXFLAGS) -MM $^>>./.depend
clean:
-rm -f $(EXE)
-rm $(OBJS)
-rm *~
-rm .depend
include .depend
</span></code></pre></div><p>Again watch the tabs. This new Makefile ensures that you only recompile changed files, minimizing compile time.</p> <h3 id="documentation"><a href="#documentation" class="header-anchor">#</a> Documentation</h3> <p>For more on make, see <a href="https://www.gnu.org/software/make/manual/" target="_blank" rel="noopener noreferrer">the official documentation by the Free Software Foundation<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, <a href="https://stackoverflow.com/documentation/makefile" target="_blank" rel="noopener noreferrer">the stackoverflow documentation<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> and <a href="http://stackoverflow.com/a/2481326/1896169" target="_blank" rel="noopener noreferrer">dmckee's elaborate answer on stackoverflow<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>.</p> <h2 id="building-with-scons"><a href="#building-with-scons" class="header-anchor">#</a> Building with SCons</h2> <p>You can build the <a href="http://stackoverflow.com/documentation/c%2B%2B/206/introduction-to-c/774/hello-world" target="_blank" rel="noopener noreferrer">cross-platform "Hello World" C++ code<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, using <a href="http://scons.org/" target="_blank" rel="noopener noreferrer">Scons<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> - A <a href="https://www.python.org/" target="_blank" rel="noopener noreferrer">Python<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>-language software construction tool.</p> <p>First, create a file called <code>SConstruct</code> (note that SCons will look for a file with this exact name by default). For now, the file should be in a directory right along your <code>hello.cpp</code>. Write in the new file the line</p> <div class="language- extra-class"><pre class="language-text"><code>
Program('hello.cpp')
</code></pre></div><p>Now, from the terminal, run <code>scons</code>. You should see something like</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code>$ scons
scons<span class="token operator">:</span> Reading SConscript files <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
scons<span class="token operator">:</span> done reading SConscript files<span class="token punctuation">.</span>
scons<span class="token operator">:</span> Building targets <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>
g<span class="token operator">++</span> <span class="token operator">-</span>o hello<span class="token punctuation">.</span>o <span class="token operator">-</span>c hello<span class="token punctuation">.</span>cpp
g<span class="token operator">++</span> <span class="token operator">-</span>o hello hello<span class="token punctuation">.</span>o
scons<span class="token operator">:</span> done building targets<span class="token punctuation">.</span>
</code></pre></div><p>(although the details will vary depending on your operating system and installed compiler).</p> <p>The <code>Environment</code> and <code>Glob</code> classes will help you further configure what to build. E.g., the <code>SConstruct</code> file</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code>env<span class="token operator">=</span><span class="token function">Environment</span><span class="token punctuation">(</span>CPPPATH<span class="token operator">=</span><span class="token string">'/usr/include/boost/'</span><span class="token punctuation">,</span>
CPPDEFINES<span class="token operator">=</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
LIBS<span class="token operator">=</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
SCONS_CXX_STANDARD<span class="token operator">=</span><span class="token string">"c++11"</span>
<span class="token punctuation">)</span>
env<span class="token punctuation">.</span><span class="token function">Program</span><span class="token punctuation">(</span><span class="token string">'hello'</span><span class="token punctuation">,</span> <span class="token function">Glob</span><span class="token punctuation">(</span><span class="token string">'src/*.cpp'</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre></div><p>builds the executable <code>hello</code>, using all <code>cpp</code> files in <code>src</code>. Its <code>CPPPATH</code> is <code>/usr/include/boost</code> and it specifies the C++11 standard.</p> <h2 id="autotools-gnu"><a href="#autotools-gnu" class="header-anchor">#</a> Autotools (GNU)</h2> <h3 id="introduction-2"><a href="#introduction-2" class="header-anchor">#</a> Introduction</h3> <p>The Autotools are a group of programs that create a GNU Build System for a given software package. It is a suite of tools that work together to produce various build resources, such as a Makefile (to be used with GNU Make). Thus, Autotools can be considered a de facto build system generator.</p> <p>Some notable Autotools programs include:</p> <ul><li>Autoconf</li> <li>Automake (not to be confused with <code>make</code>)</li></ul> <p>In general, Autotools is meant to generate the Unix-compatible script and Makefile to allow the following command to build (as well as install) most packages (in the simple case):</p> <div class="language-cpp extra-class"><pre class="language-cpp"><code><span class="token punctuation">.</span><span class="token operator">/</span>configure <span class="token operator">&&</span> make <span class="token operator">&&</span> make install
</code></pre></div><p>As such, Autotools also has a relationship with certain package managers, especially those that are attached to operating systems that conform to the POSIX Standard(s).</p> <h2 id="ninja"><a href="#ninja" class="header-anchor">#</a> Ninja</h2> <h3 id="introduction-3"><a href="#introduction-3" class="header-anchor">#</a> Introduction</h3> <p>The Ninja build system is described by its project website as <a href="https://ninja-build.org/" target="_blank" rel="noopener noreferrer">"a small build system with a focus on speed."<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> Ninja is designed to have its files generated by build system file generators, and takes a low-level approach to build systems, in contrast to higher-level build system managers like CMake or Meson.</p> <p>Ninja is primarily written in C++ and Python, and was created as an alternative to the SCons build system for the Chromium project.</p> <h2 id="nmake-microsoft-program-maintenance-utility"><a href="#nmake-microsoft-program-maintenance-utility" class="header-anchor">#</a> NMAKE (Microsoft Program Maintenance Utility)</h2> <h3 id="introduction-4"><a href="#introduction-4" class="header-anchor">#</a> Introduction</h3> <p>NMAKE is a command-line utility developed by Microsoft to be used primarily in conjunction with Microsoft Visual Studio and/or the Visual C++ command line tools.</p> <p>NMAKE is build system that falls under the Make family of build systems, but has certain distinct features that diverge from Unix-like Make programs, such as supporting Windows-specific file path syntax (which itself differs from Unix-style file paths).</p> <h4 id="remarks"><a href="#remarks" class="header-anchor">#</a> Remarks</h4> <p>Currently, there exists no universal or dominant build system for C++ that is both popular and cross-platform. However, there do exist several major build systems that are attached to major platforms/projects, the most notable being GNU Make with the GNU/Linux operating system and NMAKE with the Visual C++/Visual Studio project system.</p> <p>Additionally, some Integrated Development Environments (IDEs) also include specialized build systems to be used specifically with the native IDE. Certain build system generators can generate these native IDE build system/project formats, such as CMake for Eclipse and Microsoft Visual Studio 2012.</p></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/devtut/generate/edit/master/docs/cpp/build-systems.md" target="_blank" rel="noopener noreferrer">Edit this page on GitHub</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
←
<a href="/cpp/parameter-packs.html" class="prev">
Parameter packs
</a></span> <span class="next"><a href="/cpp/concurrency-with-openmp.html">
Concurrency With OpenMP
</a>
→
</span></p></div> </main></div><div class="global-ui"><!----></div></div>
<script src="/assets/js/app.1779e102.js" defer></script><script src="/assets/js/3.2cfa8016.js" defer></script><script src="/assets/js/622.78d8ff95.js" defer></script>
</body>
</html>