diff options
Diffstat (limited to 'cmake/modules/FindJsonSchemaBuilder.cmake')
-rw-r--r-- | cmake/modules/FindJsonSchemaBuilder.cmake | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/cmake/modules/FindJsonSchemaBuilder.cmake b/cmake/modules/FindJsonSchemaBuilder.cmake index 14aa2f5113..352cb0dea6 100644 --- a/cmake/modules/FindJsonSchemaBuilder.cmake +++ b/cmake/modules/FindJsonSchemaBuilder.cmake @@ -3,24 +3,39 @@ # --------------------- # Finds the JsonSchemaBuilder # +# If WITH_JSONSCHEMABUILDER is defined and points to a directory, +# this path will be used to search for the JsonSchemaBuilder binary +# +# # This will define the following (imported) targets:: # # JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder) - if(KODI_DEPENDSBUILD OR CMAKE_CROSSCOMPILING) + if(KODI_DEPENDSBUILD) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) + set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES + IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder") + elseif(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore) add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) - if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore) - set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES - IMPORTED_LOCATION "${DEPENDENCIES_DIR}/bin/json-rpc/JsonSchemaBuilder") + set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES + IMPORTED_LOCATION "${DEPENDENCIES_DIR}/bin/json-rpc/JsonSchemaBuilder") + else() + if(WITH_JSONSCHEMABUILDER) + get_filename_component(_jsbpath ${WITH_JSONSCHEMABUILDER} ABSOLUTE) + find_program(JSONSCHEMABUILDER_EXECUTABLE JsonSchemaBuilder PATHS ${_jsbpath}) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(JsonSchemaBuilder DEFAULT_MSG JSONSCHEMABUILDER_EXECUTABLE) + if(JSONSCHEMABUILDER_FOUND) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) + set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES + IMPORTED_LOCATION "${JSONSCHEMABUILDER_EXECUTABLE}") + endif() + mark_as_advanced(JSONSCHEMABUILDER) else() - set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES - IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder") + add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder) endif() - set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES FOLDER Tools) - else() - add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder) - add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder) - set_target_properties(JsonSchemaBuilder PROPERTIES FOLDER Tools) endif() endif() |