thomasfischer created this revision. Herald added projects: Frameworks, Build System. Herald added subscribers: kde-buildsystem, kde-frameworks-devel. thomasfischer requested review of this revision.
REVISION SUMMARY In KBibTeX, there is a `getgit.cmake` <https://cgit.kde.org/kbibtex.git/tree/src/getgit.cmake> file to collect information from Git regarding the source's history assuming that the source code came from a Git repository. `ECMSourceVersionControl.cmake` can be expanded making `getgit.cmake`'s functionality available to all KDE projects. Code from KBibTeX's `getgit.cmake` was refactored to fit `ECMSourceVersionControl.cmake` and similar code has been added to support Subversion and other version control systems. Different version control systems are supported to different degrees: - Git is fully supported thanks to the mature code from `getgit.cmake` - Subversion is well supported except for the question wheter to use `last-changed-revision` or just `revision` and how to correctly compute the commit count (some `svn log ... | grep -c ...` won't be available) - Mercurial support only covers `ECM_SOURCE_VERSION_CONTROL_BRANCH` but not `ECM_SOURCE_VERSION_CONTROL_COMMIT_COUNT` or `ECM_SOURCE_VERSION_CONTROL_REVISION` - Bazaar is virtually incomplete. However, this seems to be a dead project anyway. TEST PLAN 1. Create a temporary directory and copy either a .git, .svn, or .hg directory from another project into this directory. 2. Copy the patched `ECMSourceVersionControl.cmake` into this temporary directory. 3. Create a `CMakeLists.txt` file which may look like this: cmake_minimum_required(VERSION 3.7.2) project(ECMSourceVersionControlTest) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) include(ECMSourceVersionControl) message(${ECM_SOURCE_UNDER_VERSION_CONTROL}) message(${ECM_SOURCE_VERSION_CONTROL_REVISION}) message(${ECM_SOURCE_VERSION_CONTROL_BRANCH}) message(${ECM_SOURCE_VERSION_CONTROL_COMMIT_COUNT}) In another temporary directory, run `cmake` referring to the first temporary directory. REPOSITORY R240 Extra CMake Modules REVISION DETAIL https://phabricator.kde.org/D24641 AFFECTED FILES modules/ECMSourceVersionControl.cmake To: thomasfischer Cc: kde-frameworks-devel, kde-buildsystem, LeGast00n, GB_2, bencreasy, michaelh, ngraham, bruns