From bedd0f3c52f52b1894189e61ef39ee6cecfe9881 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 2 Oct 2012 13:12:13 +0200 Subject: [PATCH] Changed: #1444 Allow to provide custom revision.h --- code/CMakeModules/nel.cmake | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 488ad952d..24092cfea 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -30,21 +30,28 @@ MACRO(NL_GEN_REVISION_H) ADD_DEFINITIONS(-DHAVE_REVISION_H) SET(HAVE_REVISION_H ON) - # a custom target that is always built - ADD_CUSTOM_TARGET(revision ALL - DEPENDS ${CMAKE_BINARY_DIR}/revision.h) + # if already generated + IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) + # copy it + MESSAGE(STATUS "Copying provided revision.h...") + FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR}) + ELSE(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) + # a custom target that is always built + ADD_CUSTOM_TARGET(revision ALL + DEPENDS ${CMAKE_BINARY_DIR}/revision.h) - # creates revision.h using cmake script - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h - COMMAND ${CMAKE_COMMAND} - -DSOURCE_DIR=${CMAKE_SOURCE_DIR} - -DROOT_DIR=${CMAKE_SOURCE_DIR}/.. - -P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake) + # creates revision.h using cmake script + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h + COMMAND ${CMAKE_COMMAND} + -DSOURCE_DIR=${CMAKE_SOURCE_DIR} + -DROOT_DIR=${CMAKE_SOURCE_DIR}/.. + -P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake) - # revision.h is a generated file - SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h - PROPERTIES GENERATED TRUE - HEADER_FILE_ONLY TRUE) + # revision.h is a generated file + SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h + PROPERTIES GENERATED TRUE + HEADER_FILE_ONLY TRUE) + ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) ENDMACRO(NL_GEN_REVISION_H)