mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-09-19 15:19:54 +00:00
doc: explain a macro to link pre-built lib
This commit is contained in:
parent
5d23f4b8a8
commit
d00c0c1b15
10
README.md
10
README.md
@ -8,7 +8,7 @@
|
||||
|
||||
[日本語版](https://github.com/ToruNiina/toml11/blob/main/README_ja.md)
|
||||
|
||||
toml11 is a feature-rich TOML language library for C++.
|
||||
toml11 is a feature-rich TOML language library for C++11/14/17/20.
|
||||
|
||||
- It complies with [the latest TOML language specification](https://toml.io/en/v1.0.0).
|
||||
- It passes all the standard TOML language [test cases](https://github.com/toml-lang/toml-test).
|
||||
@ -124,6 +124,14 @@ $ cmake -B ./build/ -DTOML11_PRECOMPILE=ON -DCMAKE_CXX_STANDARD=11/14/17/20
|
||||
$ cmake --build ./build/
|
||||
```
|
||||
|
||||
When linking the library, use `target_link_libraries` in CMake
|
||||
|
||||
```cmake
|
||||
target_link_libraries(your_target PUBLIC toml11::toml11)
|
||||
```
|
||||
|
||||
or pass `-DTOML11_COMPILE_SOURCES` to the compiler.
|
||||
|
||||
### Building Example
|
||||
|
||||
To compile the examples in the `examples/` directory, set `-DTOML11_BUILD_EXAMPLES=ON`.
|
||||
|
10
README_ja.md
10
README_ja.md
@ -5,7 +5,7 @@
|
||||
[![License](https://img.shields.io/github/license/ToruNiina/toml11.svg?style=flat)](LICENSE)
|
||||
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1209136.svg)](https://doi.org/10.5281/zenodo.1209136)
|
||||
|
||||
toml11は、C++のための豊富な機能を持つTOML言語ライブラリです。
|
||||
toml11は、C++11,14,17,20のための豊富な機能を持つTOML言語ライブラリです。
|
||||
|
||||
- [TOML言語の最新規格](https://toml.io/ja/v1.0.0)に準拠しています。
|
||||
- TOML言語標準のテストケースすべてにパスしています。
|
||||
@ -122,6 +122,14 @@ $ cmake -B ./build/ -DTOML11_PRECOMPILE=ON -DCMAKE_CXX_STANDARD=11/14/17/20
|
||||
$ cmake --build ./build/
|
||||
```
|
||||
|
||||
ライブラリをリンクする場合は、CMakeで
|
||||
|
||||
```cmake
|
||||
target_link_libraries(your_target PUBLIC toml11::toml11)
|
||||
```
|
||||
|
||||
とするか、コンパイラに`-DTOML11_COMPILE_SOURCES`を渡してください。
|
||||
|
||||
### Building example
|
||||
|
||||
`-DTOML11_BUILD_EXAMPLES=ON`とすることで、`examples/`をコンパイルできます。
|
||||
|
@ -54,6 +54,14 @@ By defining `-DTOML11_PRECOMPILE=ON` when running cmake, you can precompile some
|
||||
$ cmake -B ./build/ -DTOML11_PRECOMPILE=ON
|
||||
```
|
||||
|
||||
When linking the library, use `target_link_libraries` in CMake
|
||||
|
||||
```cmake
|
||||
target_link_libraries(your_target PUBLIC toml11::toml11)
|
||||
```
|
||||
|
||||
or pass `-DTOML11_COMPILE_SOURCES` to the compiler to suppress header-only features.
|
||||
|
||||
However, since toml11 supports multiple C++ versions and may switch types based on the value of `__cplusplus`,
|
||||
there is a possibility of link failures if the version used during build differs from the version used during usage.
|
||||
If you encounter issues, set the required version using `CMAKE_CXX_STANDARD` during compilation.
|
||||
|
@ -54,6 +54,14 @@ target_link_libraries(main PRIVATE toml11::toml11)
|
||||
$ cmake -B ./build/ -DTOML11_PRECOMPILE=ON
|
||||
```
|
||||
|
||||
ライブラリをリンクする場合は、CMakeで
|
||||
|
||||
```cmake
|
||||
target_link_libraries(your_target PUBLIC toml11::toml11)
|
||||
```
|
||||
|
||||
とするか、ヘッダ内の関数の`inline`化を避けるためにコンパイラに`-DTOML11_COMPILE_SOURCES`を渡してください。
|
||||
|
||||
ただし、toml11は複数のC++バージョンに対応するため、`__cplusplus`の値などによって型を切り替えることがあります。
|
||||
そのため、ビルドした際のバージョンと使用時のバージョンが異なる場合、リンクに失敗する可能性があります。
|
||||
問題が生じた場合は`CMAKE_CXX_STANDARD`によって必要なバージョンを設定してコンパイルしてください。
|
||||
|
Loading…
Reference in New Issue
Block a user