aboutsummaryrefslogtreecommitdiffhomepage
path: root/development/cmake.html
diff options
context:
space:
mode:
authorjohannst <johannst@users.noreply.github.com>2024-04-05 23:16:19 +0000
committerjohannst <johannst@users.noreply.github.com>2024-04-05 23:16:19 +0000
commit63d71256f83e5da6479d90d1bbdaf17ad6d31f02 (patch)
tree764f346960e00afaf945673a365d0063f64f29ff /development/cmake.html
parent1d01762f8b174573dd58e6da1630bd92bc193512 (diff)
downloadnotes-63d71256f83e5da6479d90d1bbdaf17ad6d31f02.tar.gz
notes-63d71256f83e5da6479d90d1bbdaf17ad6d31f02.zip
deploy: c660b71b9689af89bc09671e6a6de7f9943e2709
Diffstat (limited to 'development/cmake.html')
-rw-r--r--development/cmake.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/development/cmake.html b/development/cmake.html
index 85ed59f..7bc4339 100644
--- a/development/cmake.html
+++ b/development/cmake.html
@@ -177,6 +177,19 @@
<div id="content" class="content">
<main>
<h1 id="cmake1"><a class="header" href="#cmake1">cmake(1)</a></h1>
+<h2 id="frequently-used-variables"><a class="header" href="#frequently-used-variables">Frequently used variables</a></h2>
+<pre><code># Install location.
+CMAKE_INSTALL_PREFIX=&lt;path&gt;
+
+# Generate compile_commands.json?
+CMAKE_EXPORT_COMPILE_COMMANDS={0,1}
+
+# Project build type.
+CMAKE_BUILD_TYPE={Debug, Release, RelWithDebInfo, MinSizeRel}
+
+# C++ standard.
+CMAKE_CXX_STANDARD={14,17,..}
+</code></pre>
<h2 id="private--public--interface"><a class="header" href="#private--public--interface"><code>PRIVATE</code> / <code>PUBLIC</code> / <code>INTERFACE</code></a></h2>
<p>These modifier control where properties for a given target are visible.</p>
<ul>
@@ -211,6 +224,15 @@ target_link_libraries(main liba)
[3/4] /usr/bin/c++ -DDEF_INTERFACE -DDEF_PUBLIC [..] .../main.cc
[4/4] [..]
</code></pre>
+<h2 id="find_package-ref"><a class="header" href="#find_package-ref"><code>find_package</code> [<a href="https://cmake.org/cmake/help/latest/command/find_package.html">ref</a>]</a></h2>
+<p>A small example to play with can be found in <a href="https://github.com/johannst/notes/tree/master/src/development/cmake/module">cmake/module</a>.</p>
+<pre><code class="language-cmake">find_package(Name MODULE)
+</code></pre>
+<p>Looks for <code>FindName.cmake</code> in paths given by <code>CMAKE_MODULE_PATH</code> and then builtin paths.</p>
+<pre><code class="language-cmake">find_package(Name CONFIG)
+</code></pre>
+<p>Looks for <code>name-config.cmake</code> or <code>NameConfig.cmake</code> in paths given by
+<code>CMAKE_PREFIX_PATH</code>, or path given by <code>Name_DIR</code> and then builtin paths.</p>
</main>