added -v to display version

pull/40/head
Matchman Green 2012-05-06 22:40:58 +08:00
parent 1eeaede474
commit 98f1bba4ab
4 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 2.8)
set( GRIVE_VERSION "0.0.4" )
add_subdirectory( libgrive )
add_subdirectory( grive )

View File

@ -5,6 +5,8 @@ include_directories(
${OPT_INCS}
)
add_definitions( -DVERSION="${GRIVE_VERSION}" )
add_executable( grive_executable
src/main.cc
)

View File

@ -87,7 +87,7 @@ int main( int argc, char **argv )
Json config = ReadConfig() ;
int c ;
while ((c = getopt (argc, argv, "ac:")) != -1)
while ((c = getopt (argc, argv, "ac:v")) != -1)
{
switch ( c )
{
@ -115,6 +115,13 @@ int main( int argc, char **argv )
break ;
}
case 'v' :
{
std::cout
<< "grive version " VERSION " " __DATE__ " " __TIME__ << std::endl ;
return 0 ;
}
}
}

View File

@ -34,6 +34,8 @@ file (GLOB LIBGRIVE_SRC
src/util/*.cc
)
add_definitions( -DVERSION="${GRIVE_VERSION}" )
add_library( grive SHARED ${LIBGRIVE_SRC} )
target_link_libraries( grive
@ -43,7 +45,7 @@ target_link_libraries( grive
)
set_target_properties(grive PROPERTIES
SOVERSION 0 VERSION 0.0.3
SOVERSION 0 VERSION 0.0.4
)
install(TARGETS grive LIBRARY DESTINATION lib)