diff -r f153025c5b21 -r b1c84aca28fb CMakeLists.txt --- a/CMakeLists.txt Sun Dec 09 22:38:17 2018 +0100 +++ b/CMakeLists.txt Tue Dec 18 21:39:44 2018 +0100 @@ -14,6 +14,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -project (relpipe-lib-writer.cpp) -cmake_minimum_required(VERSION 2.8) + +set(PROJECT_CODE "relpipe-lib-writer") +set(PROJECT_TITLE "Relational pipes - lib - writer (C++)") +set(PROJECT_DESCRIPTION "C++ library for writing data in relpipe format") + + +# The project version should be specified as "cmake -DPROJECT_VERSION=x.y.z" or is derived from current mercurial tag. If current revision has no tag, default version is set: +if(NOT DEFINED PROJECT_VERSION) + execute_process( + COMMAND bash -c "hg log -r '.' --template '{latesttag}:{latesttagdistance}:{branch}\\n' | sed -E -e 's/v(.*):0:.*/\\1/g' -e 's/.*:.*:v_(.*)/\\1.9999/g' | grep -E '^[0-9.]+$'" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_VERSION RESULT_VARIABLE VERSION_ERROR_CODE OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + +cmake_policy(SET CMP0048 NEW) +project (${PROJECT_CODE}.cpp VERSION ${PROJECT_VERSION}) +cmake_minimum_required(VERSION 3.10.2) add_subdirectory (src)