Skip to content

Commit

Permalink
Use pkg_config to import TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzicheng1987 committed Dec 3, 2024
1 parent b98f0e5 commit 47c9d76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,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 PkgConfig::tomlplusplus)
else()
find_package(tomlplusplus)
target_link_libraries(reflectcpp PUBLIC tomlplusplus::tomlplusplus)
Expand Down
2 changes: 0 additions & 2 deletions tests/toml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 47c9d76

Please sign in to comment.