-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
683 lines (682 loc) · 49 KB
/
index.html
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="github.css">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/googlecode.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<meta charset="utf-8">
<title>C++ submodule manager</title>
</head>
<body class="markdown-body">
<h1 id="≡-c-submodule-manager-github-stars-gitter-build-status-code-coverage"><a href="#contents">≡</a> <a href="#">C++ submodule manager</a> <a target="_blank" href="https://github.com/cppsm/cppsm.github.io"><img src="https://img.shields.io/github/stars/cppsm/cppsm.github.io.svg?style=social" alt="GitHub stars"></a> <a target="_blank" href="https://gitter.im/cppsm/community"><img src="https://badges.gitter.im/cppsm/community.svg" alt="Gitter"></a> <a target="_blank" href="https://travis-ci.org/cppsm/cppsm-cli"><img src="https://travis-ci.org/cppsm/cppsm-cli.svg?branch=master" alt="Build Status"></a> <a target="_blank" href="https://codecov.io/github/cppsm/cppsm-cli?branch=master"><img src="https://img.shields.io/codecov/c/github/cppsm/cppsm-cli/master.svg" alt="Code Coverage"></a></h1>
<p>The C++ submodule manager is fundamentally a set of <a href="#conventions">conventions</a>
for structuring projects with <a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a> and
<a target="_blank" href="https://cmake.org/">CMake <i class="fas fa-xs fa-external-link-alt"></i></a> rather than just <a href="#cppsm-command">a new tool</a>. The
goal is to make it economical to compose projects from independently developed
packages. You can basically spin off a library with CI integration and with
dependencies to other libraries and have it usable as a manageable dependency in
other projects in a matter of minutes or less.</p>
<p>Basic features:</p>
<ul>
<li>Decentralized package storage via <a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a></li>
<li>Deterministic dependencies via <a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a></li>
<li>Cross-platform via <a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a> and <a target="_blank" href="https://cmake.org/">CMake <i class="fas fa-xs fa-external-link-alt"></i></a></li>
</ul>
<p>Additional features:</p>
<ul>
<li><a href="#cppsm-command">Command line tool</a> to automate operations on projects<ul>
<li><a href="#cppsm-init-library">Generate project boilerplate</a></li>
<li><a href="#cppsm-add">Add</a>, <a href="#cppsm-remove">remove</a>, <a href="#cppsm-upgrade">upgrade</a>
dependencies</li>
<li><a href="#cppsm-format">Code formatting</a></li>
<li><a href="#cppsm-build">Build</a>, <a href="#cppsm-test">test</a>, and <a href="#cppsm-test-watch">watch</a></li>
<li>…</li>
</ul>
</li>
<li><a href="#cmake">CMake functions to minimize boilerplate</a></li>
<li><a href="#travis-ci">Travis CI integration</a></li>
<li><a href="#codecov">Codecov integration</a></li>
</ul>
<p>See <a target="_blank" href="https://github.com/topics/cppsm">repositories with the <code>#cppsm</code> topic <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
<h2 id="-≡-contents"><a id="contents"></a> <a href="#contents">≡</a> <a href="#contents">Contents</a></h2>
<ul>
<li><a href="#cppsm-command"><code>cppsm</code> command</a><ul>
<li><a href="#cppsm-supported-platforms">Supported platforms</a></li>
<li><a href="#installation">Installation</a><ul>
<li><a href="#automated-installation">Automated installation</a></li>
<li><a href="#manual-installation">Manual installation</a></li>
<li><a href="#for-optional-code-formatting">For optional code formatting</a></li>
<li><a href="#for-optional-auto-completion">For optional auto completion</a></li>
<li><a href="#for-optional-watch-commands">For optional watch commands</a></li>
</ul>
</li>
<li><a href="#quick-tour">Quick tour</a></li>
<li><a href="#subcommands">Subcommands</a><ul>
<li><a href="#cppsm"><code>cppsm</code></a></li>
<li><a href="#cppsm-add"><code>cppsm add (requires|equipment) <url> <branch></code></a></li>
<li><a href="#cppsm-build"><code>cppsm build</code></a></li>
<li><a href="#cppsm-build-watch"><code>cppsm build-watch</code></a></li>
<li><a href="#cppsm-clone"><code>cppsm clone <url> <branch></code></a></li>
<li><a href="#cppsm-format"><code>cppsm format</code></a></li>
<li><a href="#cppsm-init"><code>cppsm init</code></a><ul>
<li><a href="#init-name"><code>NAME='...'</code></a></li>
<li><a href="#init-version"><code>VERSION='v1'|'...'</code></a></li>
</ul>
</li>
<li><a href="#cppsm-init-hello"><code>cppsm init-hello</code></a></li>
<li><a href="#cppsm-init-library"><code>cppsm init-library</code></a></li>
<li><a href="#cppsm-list"><code>cppsm list</code></a></li>
<li><a href="#cppsm-remove"><code>cppsm remove <path></code></a></li>
<li><a href="#cppsm-setup"><code>cppsm setup</code></a><ul>
<li><a href="#cmake_build_type"><code>CMAKE_BUILD_TYPE=Debug|Release</code></a></li>
<li><a href="#cmake_generator"><code>CMAKE_GENERATOR=''|'...'</code></a></li>
<li><a href="#cmake_toolchain_file"><code>CMAKE_TOOLCHAIN_FILE=''|'...'</code></a></li>
<li><a href="#cc"><code>CC=cc|gcc|clang|emcc|...</code></a></li>
<li><a href="#cxx"><code>CXX=c++|g++|clang++|emcc|...</code></a></li>
<li><a href="#clean"><code>CLEAN=0|1</code></a></li>
<li><a href="#coverage"><code>COVERAGE=0|1</code></a></li>
</ul>
</li>
<li><a href="#cppsm-test"><code>cppsm test</code></a></li>
<li><a href="#cppsm-test-watch"><code>cppsm test-watch</code></a></li>
<li><a href="#cppsm-update"><code>cppsm update</code></a></li>
<li><a href="#cppsm-upgrade"><code>cppsm upgrade</code></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#cmake">CMake</a><ul>
<li><a href="#conventional-project-cmake"><code>conventional-project.cmake</code></a><ul>
<li><a href="#add_conventional_targets_under"><code>add_conventional_targets_under(directory)</code></a></li>
<li><a href="#add_conventional_targets_provided_under"><code>add_conventional_targets_provided_under(directory)</code></a></li>
<li><a href="#add_conventional_targets"><code>add_conventional_targets()</code></a></li>
</ul>
</li>
<li><a href="#conventional-targets-cmake"><code>conventional-targets.cmake</code></a><ul>
<li><a href="#add_conventional_executable"><code>add_conventional_executable(name)</code></a></li>
<li><a href="#add_conventional_executable_tests"><code>add_conventional_executable_tests(...)</code></a></li>
<li><a href="#add_conventional_library"><code>add_conventional_library(${LIBRARY_NAME}_${LIBRARY_VERSION})</code></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#travis-ci">Travis CI</a><ul>
<li><a href="#clang"><code>CLANG=1|0</code></a></li>
<li><a href="#codecov"><code>CODECOV=0|1</code></a></li>
<li><a href="#emscripten"><code>EMSCRIPTEN=0|1</code></a></li>
<li><a href="#format_check"><code>FORMAT_CHECK=1|0</code></a></li>
<li><a href="#gcc"><code>GCC=1|0</code></a></li>
<li><a href="#install_wait"><code>INSTALL_WAIT=0|1</code></a></li>
<li><a href="#upgrade_check"><code>UPGRADE_CHECK=1|0</code></a></li>
<li><a href="#vs2017"><code>VS2017=1|0</code></a></li>
<li><a href="#vs2019"><code>VS2019=1|0</code></a></li>
</ul>
</li>
<li><a href="#variables">Variables</a><ul>
<li><a href="#ctest_output_on_failure"><code>CTEST_OUTPUT_ON_FAILURE=1|0</code></a></li>
<li><a href="#quiet"><code>QUIET=1|0</code></a><ul>
<li><a href="#git_quiet"><code>GIT_QUIET=QUIET</code></a></li>
<li><a href="#msbuild_verbosity"><code>MSBUILD_VERBOSITY=QUIET|MINIMAL|NORMAL|DETAILED|DIAGNOSTIC</code></a></li>
<li><a href="#xcode_verbosity"><code>XCODE_VERBOSITY=quiet|verbose</code></a></li>
</ul>
</li>
<li><a href="#number_of_processors"><code>NUMBER_OF_PROCESSORS=1|2|...</code></a><ul>
<li><a href="#n_parallel_build"><code>N_PARALLEL_BUILD=NUMBER_OF_PROCESSORS</code></a></li>
<li><a href="#n_parallel_test"><code>N_PARALLEL_TEST=NUMBER_OF_PROCESSORS</code></a></li>
<li><a href="#n_parallel_update"><code>N_PARALLEL_UPDATE=NUMBER_OF_PROCESSORS</code></a></li>
</ul>
</li>
<li><a href="#trace"><code>TRACE=0|1</code></a><ul>
<li><a href="#xtrace"><code>XTRACE=TRACE</code></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#conventions">Conventions</a><ul>
<li><a href="#conventional-project-structure">Conventional project structure</a><ul>
<li><a href="#project">A project</a><ul>
<li><a href="#equipment-directory">The <code>equipment</code> directory</a></li>
<li><a href="#internals-directory">The <code>internals</code> directory</a></li>
<li><a href="#provides-directory">The <code>provides</code> directory</a></li>
<li><a href="#requires-directory">The <code>requires</code> directory</a></li>
</ul>
</li>
<li><a href="#project-submodule">A project submodule</a></li>
<li><a href="#target-directory">A target directory</a></li>
</ul>
</li>
<li><a href="#conventional-target-structure">Conventional target structure</a><ul>
<li><a href="#library-target">A library</a></li>
<li><a href="#testing-target">Any number of executable tests</a></li>
<li><a href="#program-target">An executable program</a></li>
</ul>
</li>
<li><a href="#conventional-project-versioning">Conventional project versioning</a><ul>
<li><a href="#project-name"><code>${PROJECT_NAME}</code></a></li>
<li><a href="#project-version"><code>${PROJECT_VERSION}</code></a></li>
</ul>
</li>
<li><a href="#conventional-library-versioning">Conventional library versioning</a></li>
</ul>
</li>
</ul>
<h2 id="-≡-cppsm-command"><a id="cppsm-command"></a> <a href="#contents">≡</a> <a href="#cppsm-command"><code>cppsm</code> command</a></h2>
<p>The <code>cppsm</code> command is basically a set of fairly simple
<a target="_blank" href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash <i class="fas fa-xs fa-external-link-alt"></i></a> scripts that automate
various operations on projects adhering to the C++ submodule manager
<a href="#conventions">conventions</a>. All the hard work is already done by
<a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a>, <a target="_blank" href="https://cmake.org/">CMake <i class="fas fa-xs fa-external-link-alt"></i></a>, and other tools and
services used. Any <code>cppsm</code> project can be used and developed without the <code>cppsm</code>
command itself.</p>
<p><a id="cppsm-supported-platforms"></a>The <code>cppsm</code> command has been developed
with <a target="_blank" href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash <i class="fas fa-xs fa-external-link-alt"></i></a> and used at least
under <a target="_blank" href="https://www.apple.com/macos/">macOS <i class="fas fa-xs fa-external-link-alt"></i></a>, <a target="_blank" href="https://www.linux.org/">Linux <i class="fas fa-xs fa-external-link-alt"></i></a>
(<a target="_blank" href="https://ubuntu.com/">Ubuntu <i class="fas fa-xs fa-external-link-alt"></i></a>), <a target="_blank" href="https://www.cygwin.com/">Cygwin <i class="fas fa-xs fa-external-link-alt"></i></a>, and
<a target="_blank" href="https://gitforwindows.org/">Git BASH <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
<p>There currently is no "native" Windows support. I personally have no need for
such support as I'm comfortable using <a target="_blank" href="https://www.cygwin.com/">Cygwin <i class="fas fa-xs fa-external-link-alt"></i></a> and
<a target="_blank" href="https://gitforwindows.org/">Git BASH <i class="fas fa-xs fa-external-link-alt"></i></a>. If you'd like to work on native Windows
support, or support for some other platform, then you are welcome to contribute
to the project!</p>
<p>At the moment the <code>cppsm</code> scripts have only been tested under
<a target="_blank" href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">Bash <i class="fas fa-xs fa-external-link-alt"></i></a> (compatible) shell
implementations. I would like to support other shells in the future.
Contributions in that regard are also welcome!</p>
<h3 id="-≡-installation"><a id="installation"></a> <a href="#contents">≡</a> <a href="#installation">Installation</a></h3>
<p>To install the <code>cppsm</code> command you need to clone its
<a target="_blank" href="https://github.com/cppsm/cppsm-cli">repository <i class="fas fa-xs fa-external-link-alt"></i></a> and add its <code>bin</code> directory to
your <code>PATH</code>.</p>
<p><a id="automated-installation"></a><a href="#automated-installation">Automated installation</a>
using the <a target="_blank" href="https://github.com/cppsm/cppsm-cli/blob/master/install"><code>install</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
script is as easy as running the pipe</p>
<pre><code class="hljs lang-bash">curl -s https://raw.githubusercontent.com/cppsm/cppsm-cli/master/install | bash</code></pre>
<p>using <a target="_blank" href="https://curl.haxx.se/"><code>curl</code> <i class="fas fa-xs fa-external-link-alt"></i></a> or the pipe</p>
<pre><code class="hljs lang-bash">wget -qO- https://raw.githubusercontent.com/cppsm/cppsm-cli/master/install | bash</code></pre>
<p>using <a target="_blank" href="https://www.gnu.org/software/wget/"><code>wget</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
<p><a id="manual-installation"></a><a href="#manual-installation">Manual installation</a> is
not hard either. Just clone the
<a target="_blank" href="https://github.com/cppsm/cppsm-cli"><code>cppsm-cli</code> <i class="fas fa-xs fa-external-link-alt"></i></a> repository somewhere, e.g.
<code>$HOME/.cppsm</code>:</p>
<pre><code class="hljs lang-bash">git clone --single-branch https://github.com/cppsm/cppsm-cli.git "$HOME/.cppsm"</code></pre>
<p>And add the following lines to your
<a target="_blank" href="https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html"><code>$HOME/.bashrc</code> or <code>$HOME/.bash_profile</code> <i class="fas fa-xs fa-external-link-alt"></i></a>:</p>
<pre><code class="hljs lang-bash">CPPSM="$HOME/.cppsm"
export PATH="$CPPSM/bin:$PATH"
. "$CPPSM/bash_completion" # NOTE: This installs optional Bash completion</code></pre>
<p>Optional dependencies:</p>
<ul>
<li><p><a id="for-optional-code-formatting"></a><a href="#for-optional-code-formatting">For optional code formatting</a>
you need to have both
<a target="_blank" href="https://clang.llvm.org/docs/ClangFormat.html"><code>clang-format</code> <i class="fas fa-xs fa-external-link-alt"></i></a> and
<a target="_blank" href="https://prettier.io/"><code>prettier</code> <i class="fas fa-xs fa-external-link-alt"></i></a> commands in path.</p>
</li>
<li><p><a id="for-optional-auto-completion"></a><a href="#for-optional-auto-completion">For optional auto completion</a>
of <a target="_blank" href="https://github.com/">GitHub <i class="fas fa-xs fa-external-link-alt"></i></a> urls you must have either
<a target="_blank" href="https://curl.haxx.se/"><code>curl</code> <i class="fas fa-xs fa-external-link-alt"></i></a> or
<a target="_blank" href="https://www.gnu.org/software/wget/"><code>wget</code> <i class="fas fa-xs fa-external-link-alt"></i></a> command and
<a target="_blank" href="https://stedolan.github.io/jq/"><code>jq</code> <i class="fas fa-xs fa-external-link-alt"></i></a> command in path.</p>
</li>
<li><p><a id="for-optional-watch-commands"></a><a href="#for-optional-watch-commands">For optional watch commands</a>
you must have either <a target="_blank" href="http://emcrisostomo.github.io/fswatch/"><code>fswatch</code> <i class="fas fa-xs fa-external-link-alt"></i></a> or
<a target="_blank" href="https://github.com/watchexec/watchexec"><code>watchexec</code> <i class="fas fa-xs fa-external-link-alt"></i></a> command in path.</p>
</li>
</ul>
<h3 id="-≡-quick-tour"><a id="quick-tour"></a> <a href="#contents">≡</a> <a href="#quick-tour">Quick tour</a></h3>
<p>Here is a quick tour of basic <code>cppsm</code> functionality.</p>
<p>Create a new empty project:</p>
<pre><code class="hljs lang-bash">mkdir PROJECT && cd "$_"
cppsm init</code></pre>
<p>At this point you could try adding dependencies or writing code, but let's
actually try the hello world example:</p>
<pre><code class="hljs lang-bash">cppsm init-hello
cppsm test
.build*/internals/hello</code></pre>
<p>Start hacking:</p>
<pre><code class="hljs lang-bash">emacs internals/program/hello.cpp &
cppsm test-watch</code></pre>
<p>Format project files inplace:</p>
<pre><code class="hljs lang-bash">cppsm format</code></pre>
<p>Clone an existing project:</p>
<pre><code class="hljs lang-bash">cppsm clone URL BRANCH</code></pre>
<p>Or clone an existing project using plain git:</p>
<pre><code class="hljs lang-bash">git clone -b BRANCH URL/NAME.git
cd NAME
git submodule update --init # NOTE: non-recursive</code></pre>
<p>Add a required library:</p>
<pre><code class="hljs lang-bash">cppsm add requires URL/NAME.git BRANCH</code></pre>
<p>Remove a previously required library:</p>
<pre><code class="hljs lang-bash">cppsm remove requires/NAME/BRANCH</code></pre>
<p>Upgrade all required libraries:</p>
<pre><code class="hljs lang-bash">cppsm upgrade</code></pre>
<h3 id="-≡-subcommands"><a id="subcommands"></a> <a href="#contents">≡</a> <a href="#subcommands">Subcommands</a></h3>
<p>Below is reference documentation for each <code>cppsm</code> subcommand. Each subcommand
also prints out short instructions to the console in case the invocation is
incorrect.</p>
<h4 id="-≡-cppsm"><a id="cppsm"></a> <a href="#contents">≡</a> <a href="#cppsm"><code>cppsm</code></a></h4>
<p>When invoked without specifying a subcommand, <code>cppsm</code> displays a brief usage
instruction and <code>cppsm</code> version information.</p>
<h4 id="-≡-cppsm-add-requiresequipment-url-branch"><a id="cppsm-add"></a> <a href="#contents">≡</a> <a href="#cppsm-add"><code>cppsm add (requires|equipment) <url> <branch></code></a></h4>
<p>Adds a new cppsm compatible submodule and recursively the submodules it requires
to the project. This command is idempotent and can be run to e.g. add new
transitive dependencies after updating submodules.</p>
<h4 id="-≡-cppsm-build"><a id="cppsm-build"></a> <a href="#contents">≡</a> <a href="#cppsm-build"><code>cppsm build</code></a></h4>
<p>Sets up a build directory and builds the project. See
<a href="#cppsm-setup"><code>cppsm setup</code></a> for the configuration variables.</p>
<h4 id="-≡-cppsm-build-watch"><a id="cppsm-build-watch"></a> <a href="#contents">≡</a> <a href="#cppsm-build-watch"><code>cppsm build-watch</code></a></h4>
<p>Sets up a build directory, builds the project, and starts a file system watch to
build the project on any changes to project files. See
<a href="#cppsm-setup"><code>cppsm setup</code></a> for the configuration variables.</p>
<h4 id="-≡-cppsm-clone-url-branch"><a id="cppsm-clone"></a> <a href="#contents">≡</a> <a href="#cppsm-clone"><code>cppsm clone <url> <branch></code></a></h4>
<p>Clones the specified cppsm compatible repository and its dependencies.</p>
<h4 id="-≡-cppsm-format"><a id="cppsm-format"></a> <a href="#contents">≡</a> <a href="#cppsm-format"><code>cppsm format</code></a></h4>
<p>Formats project files inplace using
<a target="_blank" href="https://clang.llvm.org/docs/ClangFormat.html">clang-format <i class="fas fa-xs fa-external-link-alt"></i></a> and
<a target="_blank" href="https://prettier.io/">prettier <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
<h4 id="-≡-cppsm-init"><a id="cppsm-init"></a> <a href="#contents">≡</a> <a href="#cppsm-init"><code>cppsm init</code></a></h4>
<p>Initializes a new project with cppsm configuration files when run in an empty
directory or updates an existing project to use the latest configuration files.
See also <a href="#cppsm-init-hello"><code>cppsm init-hello</code></a> and
<a href="#cppsm-init-library"><code>cppsm init-library</code></a>.</p>
<p>Configuration variables:</p>
<ul>
<li><p><a id="init-name"></a><a href="#init-name"><code>NAME='...'</code></a> specifies the base name for
the project and defaults to the name of the current directory.</p>
</li>
<li><p><a id="init-version"></a><a href="#init-version"><code>VERSION='v1'|'...'</code></a> specifies the
branch and version suffix for the project.</p>
</li>
</ul>
<h4 id="-≡-cppsm-init-hello"><a id="cppsm-init-hello"></a> <a href="#contents">≡</a> <a href="#cppsm-init-hello"><code>cppsm init-hello</code></a></h4>
<p>Initializes a new project with an example "Hello, world!" program. This is only
intended for educational purposes. See also <a href="#cppsm-init"><code>cppsm init</code></a> and
<a href="#cppsm-init-library"><code>cppsm init-library</code></a>.</p>
<pre><code>CMakeLists.txt
equipment/
testing.cpp/
v1/
provides/
CMakeLists.txt
include/
testing_v1/
[...]
library/
[...]
internals/
CMakeLists.txt
testing/
message_test.cpp
program/
hello.cpp
provides/
CMakeLists.txt
include/
message_v1/
hello.hpp
library/
hello.cpp</code></pre>
<h4 id="-≡-cppsm-init-library"><a id="cppsm-init-library"></a> <a href="#contents">≡</a> <a href="#cppsm-init-library"><code>cppsm init-library</code></a></h4>
<p>Initializes a new project with boilerplate for a simple library project in an
empty directory. See also <a href="#cppsm-init"><code>cppsm init</code></a> and
<a href="#cppsm-init-hello"><code>cppsm init-hello</code></a>.</p>
<pre><code>CMakeLists.txt
internals/
CMakeLists.txt
testing/
compile_synopsis_test.cpp
provides/
CMakeLists.txt
include/
${LIBRARY_NAME}_${LIBRARY_VERSION}/
synopsis.hpp</code></pre>
<h4 id="-≡-cppsm-list"><a id="cppsm-list"></a> <a href="#contents">≡</a> <a href="#cppsm-list"><code>cppsm list</code></a></h4>
<p>Prints out a dependency tree of submodules. This command exits with an error
code in case any problems are found in the dependency tree.</p>
<h4 id="-≡-cppsm-remove-path"><a id="cppsm-remove"></a> <a href="#contents">≡</a> <a href="#cppsm-remove"><code>cppsm remove <path></code></a></h4>
<p>Removes a previously required submodule. Note that this command does not remove
submodules transitively.</p>
<h4 id="-≡-cppsm-setup"><a id="cppsm-setup"></a> <a href="#contents">≡</a> <a href="#cppsm-setup"><code>cppsm setup</code></a></h4>
<p>Sets up a build directory. The build directory name is determined based on the
configuration variables.</p>
<p>Configuration variables:</p>
<ul>
<li><p><a id="cmake_build_type"></a><a href="#cmake_build_type"><code>CMAKE_BUILD_TYPE=Debug|Release</code></a>
<a target="_blank" href="https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html">specifies which configuration to use <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="cmake_generator"></a><a href="#cmake_generator"><code>CMAKE_GENERATOR=''|'...'</code></a>
<a target="_blank" href="https://cmake.org/cmake/help/latest/envvar/CMAKE_GENERATOR.html#envvar:CMAKE_GENERATOR">specifies which generator to use <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="cmake_toolchain_file"></a><a href="#cmake_toolchain_file"><code>CMAKE_TOOLCHAIN_FILE=''|'...'</code></a>
<a target="_blank" href="https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html">specifies toolchain file to use <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="cc"></a><a href="#cc"><code>CC=cc|gcc|clang|emcc|...</code></a>
<a target="_blank" href="https://cmake.org/cmake/help/latest/envvar/CC.html">specifies which C compiler to use <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="cxx"></a><a href="#cxx"><code>CXX=c++|g++|clang++|emcc|...</code></a>
<a target="_blank" href="https://cmake.org/cmake/help/latest/envvar/CXX.html">specifies which C++ compiler to use <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="clean"></a><a href="#clean"><code>CLEAN=0|1</code></a> specifies whether the build directory
should be recreated from scratch.</p>
</li>
<li><p><a id="coverage"></a><a href="#coverage"><code>COVERAGE=0|1</code></a> specifies whether the build
should be configured to generate coverage information. Currently code coverage
is only supported on <a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a> and
<a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
</ul>
<h4 id="-≡-cppsm-test"><a id="cppsm-test"></a> <a href="#contents">≡</a> <a href="#cppsm-test"><code>cppsm test</code></a></h4>
<p>Sets up a build directory, builds the project, and runs the tests. See
<a href="#cppsm-setup"><code>cppsm setup</code></a> for the configuration variables.</p>
<h4 id="-≡-cppsm-test-watch"><a id="cppsm-test-watch"></a> <a href="#contents">≡</a> <a href="#cppsm-test-watch"><code>cppsm test-watch</code></a></h4>
<p>Sets up a build directory, builds the project, runs the tests, and starts a file
system watch to build and test the project on any changes to project files. See
<a href="#cppsm-setup"><code>cppsm setup</code></a> for the configuration variables.</p>
<h4 id="-≡-cppsm-update"><a id="cppsm-update"></a> <a href="#contents">≡</a> <a href="#cppsm-update"><code>cppsm update</code></a></h4>
<p>Pulls the current git branch and updates all cppsm managed submodules to the
versions in the branch.</p>
<h4 id="-≡-cppsm-upgrade"><a id="cppsm-upgrade"></a> <a href="#contents">≡</a> <a href="#cppsm-upgrade"><code>cppsm upgrade</code></a></h4>
<p>Upgrades all cppsm managed submodules to latest remote versions and runs
<a href="#cppsm-init"><code>cppsm init</code></a> to update configuration files.</p>
<h2 id="-≡-cmake"><a id="cmake"></a> <a href="#contents">≡</a> <a href="#cmake">CMake</a></h2>
<p>CMake boilerplate is provided for projects and simple libraries, tests, and
executables.</p>
<h3 id="-≡-conventional-projectcmake"><a id="conventional-project-cmake"></a> <a href="#contents">≡</a> <a href="#conventional-project-cmake"><code>conventional-project.cmake</code></a></h3>
<p><a target="_blank" href="https://github.com/cppsm/cppsm-boilerplate/blob/master/conventional-project.cmake"><code>conventional-project.cmake</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
is a CMake script that (only) defines a number of CMake functions for projects
that adhere to the <a href="#conventional-project-structure">project structure</a>.</p>
<p>Typically, when using the C++ submodule manager, one does not directly call
these functions as they are called by the automatically generated boilerplate
code.</p>
<h4 id="-≡-add_conventional_targets_underdirectory"><a id="add_conventional_targets_under"></a> <a href="#contents">≡</a> <a href="#add_conventional_targets_under"><code>add_conventional_targets_under(directory)</code></a></h4>
<p>Recursively descends into the specified directory tree stopping at directories
containing a<code>CMakeLists.txt</code> script and adds those
<a href="#target-directory">target directories</a> to the project with
<a target="_blank" href="https://cmake.org/cmake/help/latest/command/add_subdirectory.html"><code>add_subdirectory</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
<h4 id="-≡-add_conventional_targets_provided_underdirectory"><a id="add_conventional_targets_provided_under"></a> <a href="#contents">≡</a> <a href="#add_conventional_targets_provided_under"><code>add_conventional_targets_provided_under(directory)</code></a></h4>
<p>Recursively descends into the specified directory tree stopping at
<a href="#project-submodule">project submodule</a> directories and adds those submodules to
the project.</p>
<ul>
<li>If a project submodule contains a <code>.cppsm</code> directory, then the <code>provides</code>
directory of the submodule is added with the
<a href="#add_conventional_targets_under"><code>add_conventional_targets_under</code></a> function.</li>
</ul>
<ul>
<li>Otherwise when a project submodule contains a <code>CMakeLists.txt</code> script, then
the directory is added to the project with
<a target="_blank" href="https://cmake.org/cmake/help/latest/command/add_subdirectory.html"><code>add_subdirectory</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</li>
</ul>
<h4 id="-≡-add_conventional_targets"><a id="add_conventional_targets"></a> <a href="#contents">≡</a> <a href="#add_conventional_targets"><code>add_conventional_targets()</code></a></h4>
<p>Adds conventional targets into a <a href="#project">project</a>.</p>
<p>Specifically, calls</p>
<ul>
<li><a href="#requires-directory"><code>add_conventional_targets_provided_under(requires)</code></a>,
and</li>
<li><a href="#provides-directory"><code>add_conventional_targets_under(provides)</code></a></li>
</ul>
<p>and, when called from the top-level of a CMake source tree, also calls</p>
<ul>
<li><a href="#equipment-directory"><code>add_conventional_targets_provided_under(equipment)</code></a>,
and</li>
<li><a href="#internals-directory"><code>add_conventional_targets_under(internals)</code></a>.</li>
</ul>
<h3 id="-≡-conventional-targetscmake"><a id="conventional-targets-cmake"></a> <a href="#contents">≡</a> <a href="#conventional-targets-cmake"><code>conventional-targets.cmake</code></a></h3>
<p><a target="_blank" href="https://github.com/cppsm/cppsm-boilerplate/blob/master/conventional-targets.cmake"><code>conventional-targets.cmake</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
is a CMake script that (only) defines a number of CMake functions for defining
targets that adhere to the
<a href="#conventional-target-structure">conventional target structure</a>.</p>
<h4 id="-≡-add_conventional_executablename"><a id="add_conventional_executable"></a> <a href="#contents">≡</a> <a href="#add_conventional_executable"><code>add_conventional_executable(name)</code></a></h4>
<p>Adds an executable target with the given name. Assumes that the target directory
has implementation files matching the pattern <code>program/*.{cpp,hpp}</code>.</p>
<pre><code>CMakeLists.txt
program/
*.{cpp,hpp}</code></pre>
<p>Add dependencies using
<a target="_blank" href="https://cmake.org/cmake/help/latest/command/target_link_libraries.html"><code>target_link_libraries</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
separately.</p>
<h4 id="-≡-add_conventional_executable_tests"><a id="add_conventional_executable_tests"></a> <a href="#contents">≡</a> <a href="#add_conventional_executable_tests"><code>add_conventional_executable_tests(...)</code></a></h4>
<p>Adds an executable test target per file matching pattern <code>testing/*.cpp</code>. The
arguments given to <code>add_conventional_executable_tests</code> are passed to
<a target="_blank" href="https://cmake.org/cmake/help/latest/command/target_link_libraries.html"><code>target_link_libraries</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
for each added test target.</p>
<pre><code>CMakeLists.txt
testing/
*.cpp</code></pre>
<h4 id="-≡-add_conventional_librarylibrary_name_library_version"><a id="add_conventional_library"></a> <a href="#contents">≡</a> <a href="#add_conventional_library"><code>add_conventional_library(${LIBRARY_NAME}_${LIBRARY_VERSION})</code></a></h4>
<p>Adds a library target with the given name. Assumes that the target directory has
public header files matching the pattern
<a href="#conventional-library-versioning"><code>include/${LIBRARY_NAME}_${LIBRARY_VERSION}/*.hpp</code></a>
and implementation files matching the pattern <code>library/*.{cpp,hpp}</code>.</p>
<pre><code>CMakeLists.txt
include/
${LIBRARY_NAME}_${LIBRARY_VERSION}/
*.hpp
library/
*.(cpp|hpp)</code></pre>
<p>Note that inside <code>include</code> there is a directory whose name
<a href="#conventional-library-versioning"><code>${LIBRARY_NAME}_${LIBRARY_VERSION}</code></a>
suggests that it should include both the library name and its major version. The
intention of the directory is to differentiate between the header files of
different targets (and their major versions).</p>
<h2 id="-≡-travis-ci"><a id="travis-ci"></a> <a href="#contents">≡</a> <a href="#travis-ci">Travis CI</a></h2>
<p>A <a target="_blank" href="https://travis-ci-ci.org/">Travis CI <i class="fas fa-xs fa-external-link-alt"></i></a>
<a target="_blank" href="https://github.com/cppsm/cppsm-cli/blob/master/.travis.yml">configuration file <i class="fas fa-xs fa-external-link-alt"></i></a>
and <a target="_blank" href="https://github.com/cppsm/cppsm-cli/blob/master/travis-ci">CI script <i class="fas fa-xs fa-external-link-alt"></i></a> is
provided to build and test both <code>Debug</code> and <code>Release</code> builds on various OS
(Linux, OS X, Windows) and compiler configurations
(<a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a>, <a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a>,
<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a>,
<a target="_blank" href="https://emscripten.org/">Emscripten <i class="fas fa-xs fa-external-link-alt"></i></a>). Just add your project to Travis CI.</p>
<ul>
<li>Linux<ul>
<li><a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a> (7)</li>
<li><a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a> (9)</li>
<li><a target="_blank" href="https://emscripten.org/">Emscripten <i class="fas fa-xs fa-external-link-alt"></i></a> (2)</li>
</ul>
</li>
<li>OS X<ul>
<li>Apple <a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a> (12)</li>
<li><a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a> (10)</li>
<li><a target="_blank" href="https://emscripten.org/">Emscripten <i class="fas fa-xs fa-external-link-alt"></i></a> (2)</li>
</ul>
</li>
<li>Windows<ul>
<li><a target="_blank" href="http://www.mingw.org/">MinGW <i class="fas fa-xs fa-external-link-alt"></i></a> <a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a> (8)</li>
<li><a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a> (2017, 2019)</li>
</ul>
</li>
</ul>
<p>Configuration variables:</p>
<ul>
<li><p><a id="clang"></a><a href="#clang"><code>CLANG=1|0</code></a> specifies whether to build with
<a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a>. Set <code>CLANG=0</code> explicitly to skip building
with <a target="_blank" href="https://clang.llvm.org/">Clang <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="codecov"></a><a href="#codecov"><code>CODECOV=0|1</code></a> specifies whether a code
coverage test is executed and results are pushed to
<a target="_blank" href="https://codecov.io/">Codecov <i class="fas fa-xs fa-external-link-alt"></i></a>. Set <code>CODECOV=1</code> explicitly to enable code
coverage.</p>
</li>
<li><p><a id="emscripten"></a><a href="#emscripten"><code>EMSCRIPTEN=0|1</code></a> specifies whether to
also build with <a target="_blank" href="https://emscripten.org/">Emscripten <i class="fas fa-xs fa-external-link-alt"></i></a>. Set <code>EMSCRIPTEN=1</code>
explicitly to build with <a target="_blank" href="https://emscripten.org/">Emscripten <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="format_check"></a><a href="#format_check"><code>FORMAT_CHECK=1|0</code></a> specifies whether
to check that source files are formatted as with
<a href="#cppsm-format"><code>cppsm format</code></a>. Set <code>FORMAT_CHECK=0</code> explicitly to disable
the format check.</p>
</li>
<li><p><a id="gcc"></a><a href="#gcc"><code>GCC=1|0</code></a> specifies whether to build with
<a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a>. Set <code>GCC=0</code> explicitly to skip building with
<a target="_blank" href="https://gcc.gnu.org/">GCC <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="install_wait"></a><a href="#install_wait"><code>INSTALL_WAIT=0|1</code></a> specifies whether
installation of additional packages is performed concurrently with builds when
possible. Set <code>INSTALL_WAIT=1</code> explicitly to wait for installations to
complete before starting any builds.</p>
</li>
<li><p><a id="upgrade_check"></a><a href="#upgrade_check"><code>UPGRADE_CHECK=1|0</code></a> specifies
whether, after running tests, a <a href="#cppsm-upgrade"><code>cppsm upgrade</code></a> is performed
and, if something is upgraded, tests are rerun. Set <code>UPGRADE_CHECK=0</code>
explicitly to skip the upgrade and conditional rerun of tests.</p>
</li>
<li><p><a id="vs2017"></a><a href="#vs2017"><code>VS2017=1|0</code></a> specifies whether to build with
<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a> 2017. Set <code>VS2017=0</code>
explicitly to skip building with
<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a> 2017.</p>
</li>
<li><p><a id="vs2019"></a><a href="#vs2019"><code>VS2019=1|0</code></a> specifies whether to build with
<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a> 2019. Set <code>VS2019=0</code>
explicitly to skip building with
<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/">Visual C++ <i class="fas fa-xs fa-external-link-alt"></i></a> 2019.</p>
</li>
</ul>
<h2 id="-≡-variables"><a id="variables"></a> <a href="#contents">≡</a> <a href="#variables">Variables</a></h2>
<p>Several environment variables can be set to change the default behavior of one
or more cppsm commands. These variables can be used both on the <a href="#travis-ci">CI</a>
and also when using <code>cppsm</code> commands locally.</p>
<h3 id="-≡-ctest_output_on_failure10"><a id="ctest_output_on_failure"></a> <a href="#contents">≡</a> <a href="#ctest_output_on_failure"><code>CTEST_OUTPUT_ON_FAILURE=1|0</code></a></h3>
<p>By default CTest is configured to
<a target="_blank" href="https://cmake.org/cmake/help/latest/envvar/CTEST_OUTPUT_ON_FAILURE.html">log output in case a test fails <i class="fas fa-xs fa-external-link-alt"></i></a>.
Set <code>CTEST_OUTPUT_ON_FAILURE=0</code> explicitly to override the default.</p>
<h3 id="-≡-quiet10"><a id="quiet"></a> <a href="#contents">≡</a> <a href="#quiet"><code>QUIET=1|0</code></a></h3>
<p>By default various commands are invoked with quiet settings to reduce noise. Set
<code>QUIET=0</code> explicitly to see more output from various commands.</p>
<ul>
<li><p><a id="git_quiet"></a><a href="#git_quiet"><code>GIT_QUIET=QUIET</code></a> controls the <code>--quiet</code>
switch for <a target="_blank" href="https://git-scm.com/">Git <i class="fas fa-xs fa-external-link-alt"></i></a> commands.</p>
</li>
<li><p><a
id="msbuild_verbosity"></a><a href="#msbuild_verbosity"><code>MSBUILD_VERBOSITY=QUIET|MINIMAL|NORMAL|DETAILED|DIAGNOSTIC</code></a>
controls the
<a target="_blank" href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference"><code>/VERBOSITY</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
switch for
<a target="_blank" href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild">MSBuild <i class="fas fa-xs fa-external-link-alt"></i></a>. If
<code>MSBUILD_VERBOSITY</code> is not explicitly set and <code>QUIET=1</code> then
<code>MSBUILD_VERBOSITY</code> will be set to <code>QUIET</code>.</p>
</li>
<li><p><a id="xcode_verbosity"></a><a href="#xcode_verbosity"><code>XCODE_VERBOSITY=quiet|verbose</code></a>
optionally passes either <code>-quiet</code> or <code>-verbose</code> flag to the <code>xcodebuild</code>
command. If <code>XCODE_VERBOSITY</code> is not explicitly set and <code>QUIET=1</code> then
<code>XCODE_VERBOSITY</code> will be set to <code>quiet</code>.</p>
</li>
</ul>
<h3 id="-≡-number_of_processors12"><a id="number_of_processors"></a> <a href="#contents">≡</a> <a href="#number_of_processors"><code>NUMBER_OF_PROCESSORS=1|2|...</code></a></h3>
<p>By default the number of processors is auto detected and parallelism is set
based on the number of processors. Set <code>NUMBER_OF_PROCESSORS</code> explicitly to
desired number to override the default.</p>
<ul>
<li><p><a id="n_parallel_build"></a><a href="#n_parallel_build"><code>N_PARALLEL_BUILD=NUMBER_OF_PROCESSORS</code></a>
controls the
<a target="_blank" href="https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project"><code>--parallel</code> option of <code>cmake --build</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="n_parallel_test"></a><a href="#n_parallel_test"><code>N_PARALLEL_TEST=NUMBER_OF_PROCESSORS</code></a>
controls the
<a target="_blank" href="https://cmake.org/cmake/help/latest/manual/ctest.1.html#options"><code>--parallel</code> option of <code>ctest</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
<li><p><a id="n_parallel_update"></a><a href="#n_parallel_update"><code>N_PARALLEL_UPDATE=NUMBER_OF_PROCESSORS</code></a>
controls the
<a target="_blank" href="https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt---jobsltngt"><code>--jobs</code> option of <code>git submodule update</code> <i class="fas fa-xs fa-external-link-alt"></i></a>.</p>
</li>
</ul>
<h3 id="-≡-trace01"><a id="trace"></a> <a href="#contents">≡</a> <a href="#trace"><code>TRACE=0|1</code></a></h3>
<p>By default scripts do not output trace information to reduce noise. Set
<code>TRACE=1</code> explicitly to see trace output.</p>
<ul>
<li><a id="xtrace"></a><a href="#xtrace"><code>XTRACE=TRACE</code></a> controls whether to
<a target="_blank" href="https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin"><code>set -x</code> <i class="fas fa-xs fa-external-link-alt"></i></a>
to enable Bash xtrace.</li>
</ul>
<h2 id="-≡-conventions"><a id="conventions"></a> <a href="#contents">≡</a> <a href="#conventions">Conventions</a></h2>
<p>C++ submodule manager projects adhere to conventions to make it simple to
operate on projects and targets programmatically and also to make room for both
independently developed projects and different versions of a single project to
coexist.</p>
<p>In order to understand how these conventions translate into practice, it can be
helpful to play with an example. The <a href="#cppsm-init-hello"><code>cppsm init-hello</code></a>
script is written for this purpose to generate a simple example project.</p>
<h3 id="-≡-conventional-project-structure"><a id="conventional-project-structure"></a> <a href="#contents">≡</a> <a href="#conventional-project-structure">Conventional project structure</a></h3>
<p>Every cppsm project must conform to the project structure, whose rules are
codified into functions defined in the
<a href="#conventional-project-cmake"><code>conventional-project.cmake</code></a> script and many of
the <a href="#subcommands">subcommands</a> of the <a href="#cppsm-command"><code>cppsm</code> command</a>.</p>
<p><a id="project"></a><a href="#project">A project</a> contains a <code>.cppsm</code> subdirectory
(containing the <a target="_blank" href="https://github.com/cppsm/cppsm-boilerplate">boilerplate <i class="fas fa-xs fa-external-link-alt"></i></a> files)
and four optional directories as follows:</p>
<ul>
<li><a id="equipment-directory"></a><a href="#equipment-directory">The <code>equipment</code> directory</a>
may contain any number of <a href="#project-submodule"><em>project submodules</em></a> that the
project internally depends upon.</li>
<li><a id="internals-directory"></a><a href="#internals-directory">The <code>internals</code> directory</a>
may contain any number of <a href="#target-directory"><em>target directories</em></a> that are
internal to the project.</li>
<li><a id="provides-directory"></a><a href="#provides-directory">The <code>provides</code> directory</a>
may contain any number of <a href="#target-directory"><em>target directories</em></a> that are
provided for dependant projects.</li>
<li><a id="requires-directory"></a><a href="#requires-directory">The <code>requires</code> directory</a>
may contain any number of <a href="#project-submodule"><em>project submodules</em></a> that the
provided targets depend upon.</li>
</ul>
<p><a id="project-submodule"></a><a href="#project-submodule">A project submodule</a> either
contains a <a href="#project">project</a> or just a <code>CMakeLists.txt</code> script. In the former
case the submodule is treated as a cppsm <a href="#project">project</a> whose targets under
<a href="#provides-directory"><code>provides</code></a> will be added to the build and in the latter
case the submodule is treated as a foreign CMake project to be added to the
build.</p>
<p><a id="target-directory"></a><a href="#target-directory">A target directory</a> simply
contains a <code>CMakeLists.txt</code> script that defines targets.</p>
<p>Note that in the common case when only a single target directory is needed under
<a href="#internals-directory"><code>internals</code></a> or <a href="#provides-directory"><code>provides</code></a>, there
is no need to create a nested directory for it and the <code>CMakeLists.txt</code> script
can go directly under the <a href="#internals-directory"><code>internals</code></a> or
<a href="#provides-directory"><code>provides</code></a> directory.</p>
<h3 id="-≡-conventional-target-structure"><a id="conventional-target-structure"></a> <a href="#contents">≡</a> <a href="#conventional-target-structure">Conventional target structure</a></h3>
<p>In a cppsm project one may optionally structure targets according to conventions
codified into functions defined in the
<a href="#conventional-targets-cmake"><code>conventional-targets.cmake</code></a> script. In that case
a target directory may simultaneously contain:</p>
<ul>
<li><a id="library-target"></a><a href="#library-target">A library</a> in the
<a href="#conventional-library-versioning"><code>include/${LIBRARY_NAME}_${LIBRARY_VERSION}</code></a>
and <code>library</code> directories.</li>
<li><a id="testing-target"></a><a href="#testing-target">Any number of executable tests</a>
in the <code>testing</code> directory.</li>
<li><a id="program-target"></a><a href="#program-target">An executable program</a> in the
<code>program</code> directory.</li>
</ul>
<h3 id="-≡-conventional-project-versioning"><a id="conventional-project-versioning"></a> <a href="#contents">≡</a> <a href="#conventional-project-versioning">Conventional project versioning</a></h3>
<p>C++ submodule manager <a href="#project">projects</a> and
<a href="#project-submodule">project submodules</a> are versioned such that the branches of
a project are named after their (major) version numbers and the version numbers
are part of the paths of submodules containing C++ submodule manager projects.</p>
<p><a id="project-name"></a>The <a href="#project-name"><code>${PROJECT_NAME}</code></a> of a C++
submodule manager project is taken to be the last (<code>/</code> separated) part of the
URL of the Git project sans the <code>.git</code> suffix.</p>
<p><a id="project-version"></a>The <a href="#project-version"><code>${PROJECT_VERSION}</code></a> of a
cppsm project is the name of a branch.</p>
<p>When added as a submodule dependency, a cppsm project whose name is
<a href="#project-name"><code>${PROJECT_NAME}</code></a> and whose version is
<a href="#project-version"><code>${PROJECT_VERSION}</code></a> goes either to
<a href="#equipment-directory"><code>equipment/${PROJECT_NAME}/${PROJECT_VERSION}</code></a> or to
<a href="#requires-directory"><code>requires/${PROJECT_NAME}/${PROJECT_VERSION}</code></a> depending
on the nature of the dependency.</p>
<h3 id="-≡-conventional-library-versioning"><a id="conventional-library-versioning"></a> <a href="#contents">≡</a> <a href="#conventional-library-versioning">Conventional library versioning</a></h3>
<p>In a cppsm project one may optionally version libraries such that their header
files start with a directory name of the form <code>${LIBRARY_NAME}_${VERSION}</code>,
which is also the name of the CMake <a href="#add_conventional_library">library target</a>
and of the namespace inside of which all the public code of the library resides
in.</p>
<p>Note that when combined with the
<a href="#conventional-project-versioning">project versioning conventions</a> this allows a
single project to potentially use multiple (major or incompatible) versions of a
single project or library. This can be very important in large projects composed
of separately develop subprojects or libraries.</p>
<p>Note that often <code>LIBRARY_NAME</code> may be the same as
<a href="#project-name"><code>PROJECT_NAME</code></a> and <code>LIBRARY_VERSION</code> may be the same as
<a href="#project-version"><code>PROJECT_VERSION</code></a>, but this is not required.</p>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/bash.min.js"></script>
<script type="text/javascript" src="init-hljs.js"></script>
<script type="text/javascript" src="tooltips.js"></script>
</body>
</html>