aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElie ROUDNINSKI <xademax@gmail.com>2018-11-10 22:41:38 +0000
committerElie ROUDNINSKI <xademax@gmail.com>2018-11-10 22:41:38 +0000
commit6945a194de509b692cd59db8ad0313604a466179 (patch)
treeadf58105c1c3afeff5c74e39c4fdb758ae001c46
parentd0a7c35877c0978e68c55412cf9e0dcab0916b22 (diff)
[cmake] Rework FindJsonSchemaBuilder on the model of FindTextureBuilder
It allows the specify the location of the JsonSchemaBuilder binary with the WITH_JSONSCHEMABUILDER cmake variable.
-rw-r--r--cmake/modules/FindJsonSchemaBuilder.cmake37
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()