read VERSION file only if it exists

This commit is contained in:
Radovan Bast 2015-05-23 11:02:18 +02:00
parent d72fefd327
commit 4e2da28705

View File

@ -176,8 +176,10 @@ def gen_cmakelists(config, relative_path, list_of_modules):
s.append('# in a file and not as cmake variable')
s.append('# is that cmake-unaware programs can')
s.append('# parse and use it (e.g. Sphinx)')
s.append('file(READ "${PROJECT_SOURCE_DIR}/VERSION" PROGRAM_VERSION)')
s.append('string(STRIP "${PROGRAM_VERSION}" PROGRAM_VERSION)')
s.append('if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION")')
s.append(' file(READ "${PROJECT_SOURCE_DIR}/VERSION" PROGRAM_VERSION)')
s.append(' string(STRIP "${PROGRAM_VERSION}" PROGRAM_VERSION)')
s.append('endif()')
s.append('\n')
s.append('# generated cmake files will be written to this path')