From 2cf8a01f35de0c26d82d3bcf6330558ac1b47bbf Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 7 Apr 2017 13:49:04 +0200 Subject: Move the repository name recognition into a function Summary: Otherwise it would pollute the namespace and weird things happened on some projects Reviewers: bshah Reviewed By: bshah Subscribers: #frameworks, #build_system Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D5332 --- kde-modules/KDECMakeSettings.cmake | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'kde-modules/KDECMakeSettings.cmake') diff --git a/kde-modules/KDECMakeSettings.cmake b/kde-modules/KDECMakeSettings.cmake index 1a694330..c536e34a 100644 --- a/kde-modules/KDECMakeSettings.cmake +++ b/kde-modules/KDECMakeSettings.cmake @@ -284,16 +284,7 @@ endif() ################################################################### # Download translations -if(NOT EXISTS ${CMAKE_SOURCE_DIR}/po) - option(KDE_L10N_AUTO_TRANSLATIONS "Automatically 'make fetch-translations`" OFF) - set(KDE_L10N_BRANCH "trunk" CACHE STRING "Branch from l10n.kde.org to fetch from: trunk | stable | lts | trunk_kde4 | stable_kde4") - - if(KDE_L10N_DOWNLOAD_TRANSLATIONS) - set(_EXTRA_ARGS "ALL") - else() - set(_EXTRA_ARGS) - endif() - +function(_repository_name reponame) execute_process(COMMAND git config --get remote.origin.url OUTPUT_VARIABLE giturl RESULT_VARIABLE exitCode @@ -302,13 +293,26 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/po) if(exitCode EQUAL 0) string(REGEX MATCHALL ".+[:\\/]([A-Za-z\\-\\d]+)(.git)?\\s*" "" ${giturl}) - set(reponame ${CMAKE_MATCH_1}) + set(${reponame} ${CMAKE_MATCH_1} PARENT_SCOPE) + endif() + + if(NOT ${reponame}) + set(${reponame} ${CMAKE_PROJECT_NAME} PARENT_SCOPE) endif() +endfunction() + +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/po) + option(KDE_L10N_AUTO_TRANSLATIONS "Automatically 'make fetch-translations`" OFF) + set(KDE_L10N_BRANCH "trunk" CACHE STRING "Branch from l10n.kde.org to fetch from: trunk | stable | lts | trunk_kde4 | stable_kde4") - if(NOT reponame) - set(reponame ${CMAKE_PROJECT_NAME}) + if(KDE_L10N_DOWNLOAD_TRANSLATIONS) + set(_EXTRA_ARGS "ALL") + else() + set(_EXTRA_ARGS) endif() + _repository_name(reponame) + add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/releaseme" COMMAND git clone --depth 1 "https://anongit.kde.org/releaseme.git" -- cgit v1.2.1