Warning, /graphics/kst-plot/cmake/modules/KstRevisionGenerator.cmake is written in an unsupported language. File is not indexed.
0001 # ***************************************************************************
0002 # * *
0003 # * Copyright : (C) 2014 Peter Kümmel *
0004 # * email : syntheticpp@gmx.net *
0005 # * *
0006 # * This program is free software; you can redistribute it and/or modify *
0007 # * it under the terms of the GNU General Public License as published by *
0008 # * the Free Software Foundation; either version 2 of the License, or *
0009 # * (at your option) any later version. *
0010 # * *
0011 # ***************************************************************************
0012
0013 find_program(KST_GIT git)
0014 if(KST_GIT)
0015 execute_process(COMMAND ${KST_GIT} rev-parse -q --short HEAD
0016 WORKING_DIRECTORY "${kst_dir}"
0017 OUTPUT_VARIABLE _revision
0018 ERROR_VARIABLE _error
0019 RESULT_VARIABLE _result
0020 OUTPUT_STRIP_TRAILING_WHITESPACE)
0021 # write a file with the KST_REVISION define
0022 file(WRITE ${header_file}.tmp "#define KST_REVISION \"${_revision}\"\n")
0023 else()
0024 file(WRITE ${header_file}.tmp "#define KST_REVISION \"unknown\"\n")
0025 endif()
0026
0027 message(STATUS "Revision: ${_revision}")
0028
0029 # copy the file to the final header only if the version changes reduces needless rebuilds
0030 execute_process(COMMAND ${CMAKE_COMMAND}
0031 -E copy_if_different
0032 ${header_file}.tmp ${header_file})