aboutsummaryrefslogtreecommitdiff
path: root/cmake/scripts/common/Macros.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/common/Macros.cmake')
-rw-r--r--cmake/scripts/common/Macros.cmake78
1 files changed, 20 insertions, 58 deletions
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake
index 65d6406ec7..fcb9659de9 100644
--- a/cmake/scripts/common/Macros.cmake
+++ b/cmake/scripts/common/Macros.cmake
@@ -72,12 +72,9 @@ function(core_add_library name)
add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS})
set_target_properties(${name} PROPERTIES PREFIX "")
set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE)
- add_dependencies(${name} ${GLOBAL_TARGET_DEPS})
# Adds global target to library. This propagates dep lib info (eg include_dir locations)
core_target_link_libraries(${name})
- # ToDo: remove the next line when the GLOBAL_TARGET_DEPS is removed completely
- target_link_libraries(${name} PRIVATE ${GLOBAL_TARGET_DEPS})
set(CORE_LIBRARY ${name} PARENT_SCOPE)
@@ -106,7 +103,7 @@ function(core_add_test_library name)
set_target_properties(${name} PROPERTIES PREFIX ""
EXCLUDE_FROM_ALL 1
FOLDER "Build Utilities/tests")
- add_dependencies(${name} ${GLOBAL_TARGET_DEPS})
+
set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE)
if(NOT MSVC)
@@ -345,15 +342,6 @@ function(copy_files_from_filelist_to_buildtree pattern)
set(install_data ${install_data} PARENT_SCOPE)
endfunction()
-# helper macro to set modified variables in parent scope
-macro(export_dep)
- set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE)
- set(DEPLIBS ${DEPLIBS} PARENT_SCOPE)
- set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE)
- set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE)
- mark_as_advanced(${depup}_LIBRARIES)
-endmacro()
-
# split dependency specification to name and version
# Arguments:
# depspec dependency specification that can optionally include a required
@@ -396,17 +384,20 @@ endmacro()
# Arguments:
# dep_list One or many dependency specifications (see split_dependency_specification)
# for syntax). The dependency name is used uppercased as variable prefix.
-# On return:
-# dependencies added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
function(core_require_dep)
foreach(depspec ${ARGN})
split_dependency_specification(${depspec} dep version)
find_package_with_ver(${dep} ${version} REQUIRED)
string(TOUPPER ${dep} depup)
- list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
- list(APPEND DEPLIBS ${${depup}_LIBRARIES})
- list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
- export_dep()
+
+ # We dont want to add a build tool
+ if (NOT ${depspec} IN_LIST optional_buildtools AND NOT ${depspec} IN_LIST required_buildtools)
+ # If dependency is found and is not in the list (eg shairplay) add to list
+ if (NOT ${depspec} IN_LIST required_deps)
+ set(required_deps ${required_deps} ${depspec} PARENT_SCOPE)
+ endif()
+ endif()
+
endforeach()
endfunction()
@@ -426,8 +417,6 @@ endmacro()
# Arguments:
# dep_list One or many dependency specifications (see split_dependency_specification)
# for syntax). The dependency name is used uppercased as variable prefix.
-# On return:
-# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
function(core_optional_dep)
foreach(depspec ${ARGN})
set(_required False)
@@ -440,12 +429,17 @@ function(core_optional_dep)
set(_required True)
endif()
- if(${depup}_FOUND)
- list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
- list(APPEND DEPLIBS ${${depup}_LIBRARIES})
- list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
+ if(TARGET kodi::${dep})
set(final_message ${final_message} "${depup} enabled: Yes")
- export_dep()
+
+ # We dont want to add a build tool
+ if (NOT ${depspec} IN_LIST optional_buildtools AND NOT ${depspec} IN_LIST required_buildtools)
+ # If dependency is found and is not in the list (eg mariadb/mysql) add to list
+ if (NOT ${depspec} IN_LIST optional_deps)
+ set(optional_deps ${optional_deps} ${depspec} PARENT_SCOPE)
+ endif()
+ endif()
+
elseif(_required)
message(FATAL_ERROR "${depup} enabled but not found")
else()
@@ -548,38 +542,6 @@ macro(core_add_optional_subdirs_from_filelist pattern)
endforeach()
endmacro()
-# Generates an RFC2822 timestamp
-#
-# The following variable is set:
-# RFC2822_TIMESTAMP
-function(rfc2822stamp)
- execute_process(COMMAND date -R
- OUTPUT_VARIABLE RESULT)
- set(RFC2822_TIMESTAMP ${RESULT} PARENT_SCOPE)
-endfunction()
-
-# Generates an user stamp from git config info
-#
-# The following variable is set:
-# PACKAGE_MAINTAINER - user stamp in the form of "username <username@example.com>"
-# if no git tree is found, value is set to "nobody <nobody@example.com>"
-function(userstamp)
- find_package(Git)
- if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
- execute_process(COMMAND ${GIT_EXECUTABLE} config user.name
- OUTPUT_VARIABLE username
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process(COMMAND ${GIT_EXECUTABLE} config user.email
- OUTPUT_VARIABLE useremail
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(PACKAGE_MAINTAINER "${username} <${useremail}>" PARENT_SCOPE)
- else()
- set(PACKAGE_MAINTAINER "nobody <nobody@example.com>" PARENT_SCOPE)
- endif()
-endfunction()
-
# Parses git info and sets variables used to identify the build
# Arguments:
# stamp variable name to return