diff options
author | fuzzard <fuzzard@kodi.tv> | 2024-05-12 13:46:05 +1000 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2024-06-22 13:17:14 +1000 |
commit | b2d661ad2d1a62e2f775650c5006392af6320521 (patch) | |
tree | aaf98e7891e0edcbb1c8a57138656516064a5a98 /cmake | |
parent | 489a7fcdd24f8002a44debd4ca7402ce6dcad384 (diff) |
[cmake][modules] FindRapidJSON cleanup and use core_target_link_libraries
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindRapidJSON.cmake | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake index df34eff2b2..10a21390d1 100644 --- a/cmake/modules/FindRapidJSON.cmake +++ b/cmake/modules/FindRapidJSON.cmake @@ -5,10 +5,10 @@ # # This will define the following target: # -# RapidJSON::RapidJSON - The RapidJSON library +# ${APP_NAME_LC}::RapidJSON - The RapidJSON library # -if(NOT TARGET RapidJSON::RapidJSON) +if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME}) include(cmake/scripts/common/ModuleHelpers.cmake) macro(buildrapidjson) @@ -71,8 +71,7 @@ if(NOT TARGET RapidJSON::RapidJSON) find_path(RAPIDJSON_INCLUDE_DIRS NAMES rapidjson/rapidjson.h HINTS ${DEPENDS_PATH}/include ${PC_RapidJSON_INCLUDEDIR} - ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG} - NO_CACHE) + ${${CORE_PLATFORM_NAME_LC}_SEARCH_CONFIG}) endif() endif() @@ -82,11 +81,11 @@ if(NOT TARGET RapidJSON::RapidJSON) VERSION_VAR RapidJSON_VERSION) if(RAPIDJSON_FOUND) - add_library(RapidJSON::RapidJSON INTERFACE IMPORTED) - set_target_properties(RapidJSON::RapidJSON PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${RAPIDJSON_INCLUDE_DIRS}") + add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} INTERFACE IMPORTED) + set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${RAPIDJSON_INCLUDE_DIRS}") if(TARGET rapidjson) - add_dependencies(RapidJSON::RapidJSON rapidjson) + add_dependencies(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} rapidjson) endif() # Add internal build target when a Multi Config Generator is used @@ -104,7 +103,9 @@ if(NOT TARGET RapidJSON::RapidJSON) endif() add_dependencies(build_internal_depends rapidjson) endif() - - set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP RapidJSON::RapidJSON) + else() + if(RapidJSON_FIND_REQUIRED) + message(FATAL_ERROR "RapidJSON library not found. You may want to try -DENABLE_INTERNAL_RapidJSON=ON") + endif() endif() endif() |