From 641afd6f53a56e7ad8e8b5dc0fbe4b96616eb435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Fri, 28 Jun 2024 22:40:07 +0200 Subject: [PATCH] Handle bundled dependencies using __has_include (#128) --- CMakeLists.txt | 4 +--- include/rfl/PatternValidator.hpp | 2 +- include/rfl/json/Reader.hpp | 2 +- include/rfl/json/Writer.hpp | 2 +- include/rfl/json/read.hpp | 2 +- include/rfl/json/save.hpp | 2 +- include/rfl/json/to_schema.hpp | 2 +- include/rfl/json/write.hpp | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7fef92..2365a28f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,8 +56,7 @@ if(REFLECTCPP_USE_BUNDLED_DEPENDENCIES) target_include_directories( reflectcpp PUBLIC $ - $ - $) + $) else() add_library(reflectcpp INTERFACE) @@ -66,7 +65,6 @@ else() $ $ ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DREFLECTCPP_NO_BUNDLED_DEPENDENCIES") target_compile_features(reflectcpp INTERFACE cxx_std_20) find_package(ctre CONFIG REQUIRED) diff --git a/include/rfl/PatternValidator.hpp b/include/rfl/PatternValidator.hpp index 3034daf0..b3e178fd 100644 --- a/include/rfl/PatternValidator.hpp +++ b/include/rfl/PatternValidator.hpp @@ -3,7 +3,7 @@ #include -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "thirdparty/ctre.hpp" diff --git a/include/rfl/json/Reader.hpp b/include/rfl/json/Reader.hpp index 8d885b4f..b0e0102a 100644 --- a/include/rfl/json/Reader.hpp +++ b/include/rfl/json/Reader.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_READER_HPP_ #define RFL_JSON_READER_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h" diff --git a/include/rfl/json/Writer.hpp b/include/rfl/json/Writer.hpp index ef5774c7..a254a3c0 100644 --- a/include/rfl/json/Writer.hpp +++ b/include/rfl/json/Writer.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_WRITER_HPP_ #define RFL_JSON_WRITER_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h" diff --git a/include/rfl/json/read.hpp b/include/rfl/json/read.hpp index a5c1edf3..359a20fb 100644 --- a/include/rfl/json/read.hpp +++ b/include/rfl/json/read.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_READ_HPP_ #define RFL_JSON_READ_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h" diff --git a/include/rfl/json/save.hpp b/include/rfl/json/save.hpp index e6f66bc3..c2010f55 100644 --- a/include/rfl/json/save.hpp +++ b/include/rfl/json/save.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_SAVE_HPP_ #define RFL_JSON_SAVE_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h" diff --git a/include/rfl/json/to_schema.hpp b/include/rfl/json/to_schema.hpp index fb61589b..d3badef6 100644 --- a/include/rfl/json/to_schema.hpp +++ b/include/rfl/json/to_schema.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_TOSCHEMA_HPP_ #define RFL_JSON_TOSCHEMA_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h" diff --git a/include/rfl/json/write.hpp b/include/rfl/json/write.hpp index 58776621..cf8f9688 100644 --- a/include/rfl/json/write.hpp +++ b/include/rfl/json/write.hpp @@ -1,7 +1,7 @@ #ifndef RFL_JSON_WRITE_HPP_ #define RFL_JSON_WRITE_HPP_ -#ifdef REFLECTCPP_NO_BUNDLED_DEPENDENCIES +#if __has_include() #include #else #include "../thirdparty/yyjson.h"