diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,9 +161,6 @@ else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() -# version number -set(VERSION_STRING "0.8.1" CACHE STRING "Program version number.") - # get revision number from mercurial find_program(MERCURIAL hg) @@ -183,9 +180,7 @@ if (NOT VERSION_REVISION) endif (NOT VERSION_REVISION) message("SCM revision: ${VERSION_REVISION}") - -# configure version file -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVERSION_REVISION=\\\"${VERSION_REVISION}\\\" ") # add make run target add_custom_target(run diff --git a/src/version.h b/src/version.h new file mode 100644 --- /dev/null +++ b/src/version.h @@ -0,0 +1,31 @@ +/* + Copyright © 2017 Hasan Yavuz Özderya + + This file is part of serialplot. + + serialplot is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + serialplot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with serialplot. If not, see . +*/ + +#ifndef VERSION_H +#define VERSION_H + +#ifndef VERSION_STRING +#define VERSION_STRING "0.8.1" +#endif + +#ifndef VERSION_REVISION +#define VERSION_REVISION "" +#endif + +#endif // VERSION_H