Don't need the messages when SCL is a subbuild.

This commit is contained in:
Cliff Yapp 2012-03-22 17:05:54 +00:00
parent 830a7b7b90
commit 5f63f3d021
2 changed files with 16 additions and 5 deletions

View file

@ -258,12 +258,13 @@ configure_file(${CONFIG_H_FILE} ${SCL_BINARY_DIR}/include/scl_cf.h)
# Using 'ver_string' instead of 'scl_version_string.h' is a trick to force the
# command to always execute when the custom target is built. It works because
# a file by that name never exists.
configure_file(${SCL_CMAKE_DIR}/scl_version_string.cmake ${SCL_BINARY_DIR}/scl_version_string.cmake @ONLY)
add_custom_target(version_string ALL DEPENDS ver_string )
# creates scl_version_string.h using cmake script
add_custom_command(OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR}/include/scl_version_string.h
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SCL_SOURCE_DIR}
-DBINARY_DIR=${SCL_BINARY_DIR}
-P ${SCL_CMAKE_DIR}/scl_version_string.cmake)
-P ${SCL_BINARY_DIR}/scl_version_string.cmake)
# scl_version_string.h is a generated file
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/include/scl_version_string.h
PROPERTIES GENERATED TRUE

View file

@ -7,6 +7,8 @@
#scl_version_string.h defines scl_version() which returns a pretty commit description and a build timestamp.
set(IS_SUBBUILD "@IS_SUBBUILD@")
set(VERS_FILE ${SOURCE_DIR}/SCL_VERSION.txt )
if( EXISTS ${SOURCE_DIR}/.git )
find_package(Git QUIET)
@ -14,15 +16,21 @@ if( EXISTS ${SOURCE_DIR}/.git )
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COMMIT_ID )
if( NOT ${res_var} EQUAL 0 )
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
message( WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}." )
if(NOT IS_SUBBUILD)
message( WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}." )
endif(NOT IS_SUBBUILD)
endif()
else(GIT_FOUND)
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
message( WARNING "Git not found. Build will contain revision info from ${VERS_FILE}." )
if(NOT IS_SUBBUILD)
message( WARNING "Git not found. Build will contain revision info from ${VERS_FILE}." )
endif(NOT IS_SUBBUILD)
endif(GIT_FOUND)
else()
file( READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255 )
message( WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}." )
if(NOT IS_SUBBUILD)
message( WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}." )
endif(NOT IS_SUBBUILD)
endif()
string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID} )
@ -45,4 +53,6 @@ file(WRITE scl_version_string.h.txt ${vstring} )
# reduces needless rebuilds
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
scl_version_string.h.txt ${BINARY_DIR}/include/scl_version_string.h)
message("-- scl_version_string.h is up-to-date.")
if(NOT IS_SUBBUILD)
message("-- scl_version_string.h is up-to-date.")
endif(NOT IS_SUBBUILD)