mirror of https://github.com/QMCPACK/qmcpack.git
Move non-git source version info to subdirectory
In the case where source is not a git repository, an empty repository info file is created at configure time. The git-rev.h file is placed in the src/ subdirectory. If the code to create it is in the top-level CMakeLists.txt, the src/ directory does not yet exist and it fails to create the file. Move the git-ver.h file creation code to the src/CMakeLists.txt.
This commit is contained in:
parent
b7afe0b0a1
commit
1fba9520cc
|
@ -271,21 +271,6 @@ IF (EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
|||
SET(IS_GIT_PROJECT true)
|
||||
ENDIF()
|
||||
|
||||
SET(GITREV_BARE_FILE git-rev.h)
|
||||
SET(GITREV_BARE_TMP git-rev-tmp.h)
|
||||
SET(GITREV_FILE ${CMAKE_BINARY_DIR}/src/${GITREV_BARE_FILE})
|
||||
SET(GITREV_TMP ${CMAKE_BINARY_DIR}/src/${GITREV_BARE_TMP})
|
||||
|
||||
IF (NOT (GIT_FOUND AND IS_GIT_PROJECT))
|
||||
# Output a blank git version file
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${GITREV_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${GITREV_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${GITREV_TMP}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${GITREV_TMP}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
|
||||
######################################################
|
||||
#COMPILER choose one of the cmake files to customize the compiler options
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
CONFIGURE_FILE(${qmcpack_SOURCE_DIR}/src/config.h.cmake.in
|
||||
${qmcpack_BINARY_DIR}/src/config.h)
|
||||
|
||||
SET(GITREV_BARE_FILE git-rev.h)
|
||||
SET(GITREV_BARE_TMP git-rev-tmp.h)
|
||||
SET(GITREV_FILE ${CMAKE_BINARY_DIR}/src/${GITREV_BARE_FILE})
|
||||
SET(GITREV_TMP ${CMAKE_BINARY_DIR}/src/${GITREV_BARE_TMP})
|
||||
|
||||
IF (GIT_FOUND AND IS_GIT_PROJECT)
|
||||
# The following custom command picks up changes to the git revision information
|
||||
# every time the project is rebuilt. Even if the repositiory is updated (git pull)
|
||||
|
@ -49,6 +54,14 @@ IF (GIT_FOUND AND IS_GIT_PROJECT)
|
|||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
VERBATIM
|
||||
)
|
||||
ELSE()
|
||||
# Output a blank git version file
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${GITREV_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${GITREV_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${GITREV_TMP}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${GITREV_TMP}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue