aboutsummaryrefslogtreecommitdiff
path: root/cmake/addons/depends/CMakeLists.txt
blob: 831e0ed74ca5e0016ad51c85b6ae0896927ae6a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cmake_minimum_required(VERSION 3.1)
project(kodi-addons-depends)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release)
endif()

if(NOT CORE_SYSTEM_NAME)
  string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
endif()

include(ExternalProject)

if(NOT ADDON_DEPENDS_PATH)
  set(ADDON_DEPENDS_PATH ${PROJECT_SOURCE_DIR}/../build/depends)
else()
  file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
endif()
get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
list(APPEND CMAKE_PREFIX_PATH ${ADDON_DEPENDS_PATH})

if(NOT BUILD_DIR)
    set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
else()
  file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
endif()
get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)

## use add_addon_depends to handle the cmake based dependencies
include(${CORE_SOURCE_DIR}/cmake/scripts/common/HandleDepends.cmake)
add_addon_depends(depends "${PROJECT_SOURCE_DIR}")

## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well
if(EXISTS ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt)
  message(STATUS "Processing ${CORE_SYSTEM_NAME}")
  add_subdirectory(${CORE_SYSTEM_NAME})
else()
  message(STATUS "No platform specific file ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt found")
endif()