1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-02-06 05:08:22 +08:00
QXlsx/HowToSetProject-cmake.md

34 lines
660 B
Markdown
Raw Normal View History

2021-02-12 22:11:11 +09:00
## Using cmake
> *Read this in other languages: [English](HowToSetProject-cmake.md), :kr: [한국어](HowToSetProject-cmake.ko.md)*
2022-10-15 14:29:30 +01:00
### To install QXlsx
2021-02-12 22:11:11 +09:00
2022-10-15 14:29:30 +01:00
Enter the command as shown below.
2021-02-12 23:52:03 +09:00
2022-10-15 14:29:30 +01:00
```sh
2021-02-12 22:11:11 +09:00
mkdir build
cd build
2022-10-15 14:29:30 +01:00
cmake ../QXlsx/ -DCMAKE_INSTALL_PREFIX=... -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --install .
2021-02-12 23:52:03 +09:00
```
2022-10-15 14:29:30 +01:00
### To use in your application
2021-03-07 18:15:54 +09:00
2022-10-15 14:29:30 +01:00
In your CMakeLists.txt:
2021-03-07 18:15:54 +09:00
2022-10-15 14:29:30 +01:00
```cmake
find_package(QXlsxQt5 REQUIRED) # or QXlsxQt6
target_link_libraries(myapp PRIVATE QXlsx::QXlsx)
2021-03-07 18:15:54 +09:00
```
2022-10-15 14:29:30 +01:00
### To use in your application without installation
2021-03-07 18:15:54 +09:00
2022-10-15 14:29:30 +01:00
In your CMakeLists.txt:
2021-02-12 23:52:03 +09:00
2022-10-15 14:29:30 +01:00
```cmake
add_subdirectory(QXlsx)
target_link_libraries(myapp PRIVATE QXlsx::QXlsx)
2021-02-12 22:11:11 +09:00
```