Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
null committed Oct 9, 2023
1 parent 5cba84a commit 77ee410
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
36 changes: 18 additions & 18 deletions set-standard/index.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Set C/C++ standard

<<< ./CMakeLists.txt{cmake}

::: code-group

<<< ./src/main1.c

<<< ./src/main2.cpp

:::

```sh
cmake -B build
cmake --build build
```

<iframe frameborder="0" height="500" style="width: 100%" src="https://replit.com/@jcbhmr/cmakebyexampledev-set-standard?embed=1#CMakeLists.txt"></iframe>
# Set C/C++ standard

<<< ./CMakeLists.txt{cmake}

::: code-group

<<< ./src/main1.c

<<< ./src/main2.cpp

:::

```sh
cmake -B build
cmake --build build
```

<iframe frameborder="0" height="500" style="width: 100%" src="https://replit.com/@jcbhmr/cmakebyexampledev-set-standard?embed=1#CMakeLists.txt"></iframe>
2 changes: 1 addition & 1 deletion static/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.0)
project(myproject)
add_library(mylib STATIC lib.c)
add_library(mylib STATIC mylib.c)
10 changes: 7 additions & 3 deletions static/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Build a static library

We can use the `add_library()` function to define a `STATIC` library (`.a`) or [a `SHARED` library (`.so`)].
We can use the `add_library()` function to define a `STATIC` library (`.a` or
`.lib`) ora `SHARED` library (`.so` or `.dll`). Check out the [build a shared
library] example for the `SHARED` counterpart.

<<< ./CMakeLists.txt{cmake}
<<< ./CMakeLists.txt{3 cmake}

<<< ./lib.c
<<< ./mylib.c

<iframe frameborder="0" style="width: 100%; height: 500px" src="https://replit.com/@jcbhmr/cmakebyexampledev-static?embed=1"></iframe>

[build a shared library]: /shared/
1 change: 1 addition & 0 deletions static/lib.c → static/mylib.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <mylib.h>
int add(int a, int b) {
return a + b;
}

0 comments on commit 77ee410

Please sign in to comment.