No subject


Wed Oct 5 12:28:58 EDT 2011


configure_file(version.txt ${PROJECT_BINARY_DIR}/version.txt COPYONLY)

Another possibility would be to create a CMake script (e.g. called
createVersionHeader.cmake) which reads version.txt and creates a header
file version.h defining VERSION which you then include everywhere where
it is required. In your CMakeLists.txt file you first configure_file
this script to contain the paths to PROJECT_SOURCE_DIR and
PROJECT_BINARY_DIR and you run it using add_custom_command. This has the
advantage that whenever version.txt changes, CMake doesn't have to
reconfigure the whole project, only an additional rule will be run.

HTH

Michael


More information about the CMake mailing list