1#
2# Copyright (c) 2010-2014, Gilles Caulier, <caulier dot gilles at gmail dot com>
3#
4# Redistribution and use is allowed according to the terms of the BSD license.
5# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
6
7set(CMAKE_BACKWARDS_COMPATIBILITY "2.4")
8
9# See if we have git installed
10find_program(GITEXEC git)
11
12# Read the version if installed, else set to "unknown"
13if(GITEXEC)
14    execute_process(COMMAND ${GITEXEC} --git-dir=@CMAKE_CURRENT_SOURCE_DIR@/.git rev-parse HEAD OUTPUT_VARIABLE MYVERSION)
15    if(MYVERSION)
16        # Remove the newline that git returns
17        string(STRIP ${MYVERSION} MYVERSION)
18    endif()
19else()
20    set(MYVERSION unknown)
21endif()
22
23# Configure the gitversion.h
24configure_file("@CMAKE_CURRENT_SOURCE_DIR@/cmake/templates/gitversion.h.cmake.in"
25               "@CMAKE_CURRENT_BINARY_DIR@/common/libkipiplugins/gitversion.h")
26