diff options
author | Aleix Pol <aleixpol@kde.org> | 2017-04-07 13:49:04 +0200 |
---|---|---|
committer | Aleix Pol <aleixpol@kde.org> | 2017-04-07 14:03:56 +0200 |
commit | 2cf8a01f35de0c26d82d3bcf6330558ac1b47bbf (patch) | |
tree | eafe65dead21c2d7875db0dc593c60b84517e723 | |
parent | 2e3e8c10c9564f41ef76a67842ce714fefd501c6 (diff) | |
download | extra-cmake-modules-2cf8a01f35de0c26d82d3bcf6330558ac1b47bbf.tar.gz extra-cmake-modules-2cf8a01f35de0c26d82d3bcf6330558ac1b47bbf.tar.bz2 |
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
-rw-r--r-- | kde-modules/KDECMakeSettings.cmake | 30 |
1 files changed, 17 insertions, 13 deletions
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" |