Use pkg-config for the TOML package (#291)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2024-12-06 17:53:40 +01:00
committed by GitHub
parent b98f0e5df4
commit 609c561354
7 changed files with 12 additions and 29 deletions
-2
View File
@@ -6,8 +6,6 @@ env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
windows-msvc-conan:
runs-on: windows-latest
windows-msvc:
runs-on: windows-latest
steps:
+3 -11
View File
@@ -58,8 +58,6 @@ else()
target_compile_options(reflectcpp PRIVATE $<$<CONFIG:Debug>:-Wall -Wextra>)
endif()
# target_compile_features(reflectcpp PUBLIC cxx_std_20)
set(REFLECT_CPP_SOURCES
src/reflectcpp.cpp
)
@@ -147,12 +145,9 @@ if (REFLECTCPP_TOML)
src/reflectcpp_toml.cpp
)
if(REFLECTCPP_USE_VCPKG)
target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
if (MSVC)
target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/tomlplusplus${CMAKE_STATIC_LIBRARY_SUFFIX}")
else ()
target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libtomlplusplus${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif ()
find_package(PkgConfig REQUIRED)
pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus)
target_link_libraries(reflectcpp PUBLIC PkgConfig::tomlplusplus)
else()
find_package(tomlplusplus)
target_link_libraries(reflectcpp PUBLIC tomlplusplus::tomlplusplus)
@@ -163,9 +158,6 @@ if (REFLECTCPP_UBJSON)
list(APPEND REFLECT_CPP_SOURCES
src/reflectcpp_ubjson.cpp
)
if(REFLECTCPP_USE_VCPKG)
target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
endif()
find_package(jsoncons CONFIG REQUIRED)
endif ()
+1 -12
View File
@@ -545,18 +545,7 @@ The following compilers are supported:
### Using vcpkg
```bash
vcpkg install reflectcpp
```
or:
```bash
vcpkg add port reflectcpp
```
If the library cannot be found, please update vcpkg itself and/or update the `builtin-baseline`
tag in the *vcpkg.json* of your project.
https://vcpkg.io/en/package/reflectcpp
### Using Conan
+4
View File
@@ -14,6 +14,10 @@ You can include the source files into your build or compile it using cmake and v
## Option 1: Using vcpkg
Refer to the following port:
https://vcpkg.io/en/package/reflectcpp
```bash
vcpkg install reflectcpp
```
-2
View File
@@ -8,8 +8,6 @@ add_executable(
)
target_precompile_headers(reflect-cpp-toml-tests PRIVATE [["rfl.hpp"]] <iostream> <string> <functional> <gtest/gtest.h>)
target_include_directories(reflect-cpp-toml-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
target_link_libraries(
reflect-cpp-toml-tests
PRIVATE
-2
View File
@@ -8,8 +8,6 @@ add_executable(
)
target_precompile_headers(reflect-cpp-ubjson-tests PRIVATE [["rfl.hpp"]] <iostream> <string> <functional> <gtest/gtest.h>)
target_include_directories(reflect-cpp-ubjson-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
target_link_libraries(
reflect-cpp-ubjson-tests
PRIVATE
+4
View File
@@ -70,6 +70,10 @@
{
"name": "vcpkg-cmake-config",
"version>=": "2022-02-06#1"
},
{
"name":"vcpkg-pkgconfig-get-modules",
"version>=": "2024-04-03"
}
]
}