CMakeLists.txt 3.02 KB
Newer Older
1 2
############################################################################
# CMakeLists.txt
3
# Copyright (C) 2014-2018  Belledonne Communications, Grenoble France
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 21 22
#
############################################################################

23
if(LINPHONE_BUILDER_CHECK_LATEST)
Ghislain MARY's avatar
Ghislain MARY committed
24

25
	find_package(Git)
Ghislain MARY's avatar
Ghislain MARY committed
26

27 28 29 30 31 32 33 34 35 36 37 38
	file(GLOB _builders RELATIVE ${CMAKE_CURRENT_LIST_DIR} "${CMAKE_CURRENT_LIST_DIR}/*.cmake")
	list(SORT _builders)
	foreach(_builder ${_builders})
		include("${CMAKE_CURRENT_LIST_DIR}/${_builder}")
		get_filename_component(_builder_name ${_builder} NAME_WE)
		if(EP_${_builder_name}_GIT_TAG_LATEST)
			execute_process(COMMAND "${GIT_EXECUTABLE}" "ls-remote" "${EP_${_builder_name}_GIT_REPOSITORY}" "${EP_${_builder_name}_GIT_TAG_LATEST}"
				OUTPUT_FILE "${LINPHONE_BUILDER_WORK_DIR}/EP_${_builder_name}_git_latest")
			execute_process(COMMAND "head" "-n1" "${LINPHONE_BUILDER_WORK_DIR}/EP_${_builder_name}_git_latest"
				OUTPUT_VARIABLE _builder_latest)
			string(REPLACE "\t" ";" _builder_latest ${_builder_latest})
			list(GET _builder_latest 0 _builder_latest_git_tag)
Ghislain MARY's avatar
Ghislain MARY committed
39
			if(EP_${_builder_name}_GIT_TAG STREQUAL "${_builder_latest_git_tag}")
40 41 42 43 44 45 46 47
				message(STATUS "${_builder_name} is up-to-date")
			else()
				message(STATUS "${_builder_name} is outdated: ${EP_${_builder_name}_GIT_TAG} instead of ${_builder_latest_git_tag} [${EP_${_builder_name}_GIT_TAG_LATEST}]")
			endif()
		else()
			message(STATUS "${_builder_name} is up-to-date")
		endif()
	endforeach()
48

49
else()
Ghislain MARY's avatar
Ghislain MARY committed
50

51 52 53 54
	if(NOT DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE)
		set(DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
	endif()

55 56 57
	# Include targets definitions
	include(${CMAKE_CURRENT_LIST_DIR}/../targets/CMakeLists.txt)

58 59 60 61 62
	if(LINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH)
		message(STATUS "Including external builders from ${LINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH}")
		include(${LINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH}/CMakeLists.txt)
	endif()

63
	# Include common builder options definitions
64
	include(${CMAKE_CURRENT_LIST_DIR}/../options/common.cmake)
Ghislain MARY's avatar
Ghislain MARY committed
65

66 67 68
	# Check for build tools and show an error if one of them is not present
	include(${CMAKE_CURRENT_LIST_DIR}/../cmake/CheckBuildTools.cmake)

69 70 71 72
	# Check that the chosen target is valid and declare it with its dependencies
	lcb_check_target()
	lcb_declare_targets()

73
endif()