Using CMake to set the program version. This is an example of how a CMake variable can be used inside the C++ code without breaking anything.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@326 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2013-01-22 20:40:25 +00:00
parent 63a8df6c8f
commit 414b807f92
2 changed files with 8 additions and 10 deletions

View File

@ -18,7 +18,7 @@
########################################################################
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. This is bad practice.")
message(FATAL_ERROR "Prevented in-tree build. This is bad practice. Try 'cd build && cmake ../' ")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
########################################################################
@ -119,9 +119,6 @@ if(NOT GNURADIO_CORE_FOUND)
message(FATAL_ERROR "Please install GNU Radio and all its dependencies. Visit http://gnuradio.org")
endif(NOT GNURADIO_CORE_FOUND)
find_package(Gruel)
if(NOT GRUEL_FOUND)
message(FATAL_ERROR "Gruel required to build gnss-sdr")
@ -129,10 +126,6 @@ endif()
link_libraries(gruel)
include_directories(${GRUEL_INCLUDE_DIRS})
find_package(UHD)
if(NOT UHD_FOUND)
message(FATAL_ERROR "UHD required to build gnss-sdr")
@ -481,6 +474,8 @@ endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
list(APPEND CMAKE_CXX_FLAGS ${MY_CXX_FLAGS})
add_definitions( -DGNSS_SDR_VERSION="${VERSION}" )
########################################################################
# Add subdirectories (in order of deps)
########################################################################

View File

@ -8,7 +8,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2013 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,6 +30,9 @@
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_VERSION
#define GNSS_SDR_VERSION "0.0.1"
#endif
#include <boost/filesystem.hpp>
#include <gflags/gflags.h>
@ -73,7 +76,7 @@ int main(int argc, char** argv)
google::SetUsageMessage(intro_help);
google::SetVersionString("0.1");
google::SetVersionString(GNSS_SDR_VERSION);
google::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Initializing GNSS-SDR... Please wait." << std::endl;