>> Hello, >> >> I use gengetopt to generate command line parser for my application. The >> configuration file *.ggo also specifies programs version like this: >> >> # Name of your program >> package "hwtest" # don't use package if you're using automake >> # Version of your program >> version "1.2.1" # don't use version if you're using automake >> .... >> >> I'd like to automatically extract these version numbers and assign them to >> >> CPACK_PACKAGE_VERSION_MAJOR, CPACK_PACKAGE_VERSION_MINOR and >> CPACK_PACKAGE_VERSION_PATCH >> >> What were the best solution for my problem? > > I would say that the simplest solution is to keep those number in your > CMakeLists.txt > and use CONFIGURE_FILE(yourfile.ggo.in yourfile.ggo @ONLY) > > yourfile.ggo.in could then contain: > > # Name of your program > package "hwtest" # don't use package if you're using automake > # Version of your program > version > "@package_version_ma...@.@package_version_mi...@.@PACKAGE_VERSION_PATCH@" > # don't use version if you're using automake > > or even > # Name of your program > package "hwtest" # don't use package if you're using automake > # Version of your program > version @PACKAGE_VERSION@ # don't use version if you're using automake > > alternatively you can use a config.h which contains a VERSION macro > and compile your gengetopt generated C files with > -DHAVE_CONFIG_H=1 > > (just add ADD_DEFINITION(-DHAVE_CONFIG_H=1) to your CMakeLists.txt) > > in this second case YOU MUST NOT define version inside *.ggo because > the VERSION will comes from config.h. > > I use the latter method because it was the method used by our previous > autotools build system. Choosing between those 2 is a matter of taste. >
Thank you for the hint. I'll try this. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
