From e1ebdefdd4466a907f3171bcc1162a22c6bb97f2 Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Tue, 9 May 2023 17:26:12 +0200 Subject: [PATCH] Handle nlohmann dependency Not an ideal approach, but required in order for the exported target to have appropriate linkage. Maybe this can be designed to become a PRIVATE link library, but then how does it ensure the target is installed? Signed-off-by: Cristian Le --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f83c703..a02f929 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,22 @@ else () endif () endif () +# Handle configure flags +if (JSON_VALIDATOR_INSTALL) + # TODO: This is not ideal, this package should not be installing nlohmann::json + # Currently required in order to satisfy cmake exporter + set(JSON_Install ON CACHE BOOL "") +endif () + # Get all dependencies FetchContent_MakeAvailable(${fetch_packages}) +if (JSON_VALIDATOR_INSTALL AND NOT nlohmann_json_FOUND AND JSON_Install) + # TODO: This is not ideal + message(WARNING + "JsonValidator: No nlohmann::json found on the system and nlohmann_json_schema_validator will be installed\n" + "This will also install nlohmann::json in its typical installation path\n" + "This is not ideal because it might overwrite system installed") +endif () #[==============================================================================================[ # Main definition #