diff options
author | Wolfgang Schupp <w.schupp@a1.net> | 2018-11-11 08:23:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-11 08:23:25 +0100 |
commit | 8af157dd05958a4d25c69747ab0c953dc8e43e66 (patch) | |
tree | 59ce2d5c62e279c445d3e709c8bbebbbd04286a2 | |
parent | daf3607ed6544834e2950e4de07203db17bbc529 (diff) | |
parent | 6945a194de509b692cd59db8ad0313604a466179 (diff) |
Merge pull request #14774 from marmeladema/cmake-FindJsonSchemaBuilder-rework
[cmake] Rework FindJsonSchemaBuilder on the model of FindTextureBuilder
-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() |