You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,11 @@ C++ implementation of NodeJS [dotenv](https://github.com/motdotla/dotenv) projec
39
39
40
40
Supported build methods are:
41
41
42
-
-[CMake](#cmake) (>=3.10)
42
+
-[CMake](#cmake) (>=3.16)
43
43
44
44
### CMake
45
45
46
-
**cpp-dotenv** comes with support for `CMake` right out of the box. In order to use it, simply include this repository's directory and link the `cpp_dotenv` target to your own targets where needed:
46
+
**cpp-dotenv** comes with support for `CMake` right out of the box (>=3.16). In order to use it, simply include this repository's directory and link the `cpp_dotenv` target to your own targets where needed:
After this, you might use the library as described in [usage](#usage); no extra scoping, no need to worry about the project's directory structure.
57
57
58
+
#### Build Options
59
+
60
+
By default, only one library target named `cpp_dotenv` is built. The type of library (static or shared) is controlled by CMake's standard `BUILD_SHARED_LIBS` option:
61
+
62
+
```bash
63
+
# Build static library (default)
64
+
cmake -DBUILD_SHARED_LIBS=OFF ..
65
+
66
+
# Build shared library
67
+
cmake -DBUILD_SHARED_LIBS=ON ..
68
+
```
69
+
70
+
#### Building Both Static and Shared Libraries
71
+
72
+
To build both static and shared libraries in a single build directory, use the `BUILD_BOTH_LIBRARIES` option:
73
+
74
+
```bash
75
+
cmake -DBUILD_BOTH_LIBRARIES=ON ..
76
+
```
77
+
78
+
This creates two separate library targets:
79
+
-`cpp_dotenv_static` - outputs as `libcpp_dotenv.a`
80
+
-`cpp_dotenv_shared` - outputs as `libcpp_dotenv.so` (or `.dylib` on macOS)
81
+
82
+
For backward compatibility, the `cpp_dotenv` target remains available as an alias to `cpp_dotenv_static`. If you need to link against the shared library, explicitly specify `cpp_dotenv_shared`:
0 commit comments