mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-24 11:40:31 -05:00
Fixed and improved SVN revision lookup in the CMake script.
The lookup was broken and always returning 'local'. It now returns 'local' for a non svn source tree, 'r<revno>-dirty' for a source tree with uncommitted changes, 'r<revno>' for a clean svn source tree. Unversioned files are ignored for now. Also added some diagnstics output in CMake script to aid debugging Qt plugin location issues. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3934 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
9639ce12f2
commit
5709ae53df
@ -1,14 +1,28 @@
|
||||
find_package (Subversion)
|
||||
if (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||
if (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
# the FindSubversion.cmake module is part of the standard distribution
|
||||
include (FindSubversion)
|
||||
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||
Subversion_WC_INFO (${SOURCE_DIR} MY)
|
||||
message ("${MY_WC_INFO}")
|
||||
# determine if the working copy has outstanding changes
|
||||
execute_process (COMMAND ${Subversion_SVN_EXECUTABLE} status ${SOURCE_DIR}
|
||||
OUTPUT_FILE "${OUTPUT_DIR}/svn_status.txt"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
file (STRINGS "${OUTPUT_DIR}/svn_status.txt" __svn_changes
|
||||
REGEX "^[^?].*$"
|
||||
)
|
||||
if (__svn_changes)
|
||||
set (MY_WC_REVISION "${MY_WC_REVISION}-dirty")
|
||||
foreach (__svn_change ${__svn_changes})
|
||||
message (STATUS "${__svn_change}")
|
||||
endforeach (__svn_change ${__svn_changes})
|
||||
endif (__svn_changes)
|
||||
# write a file with the SVNVERSION define
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION r${MY_WC_REVISION}\n")
|
||||
else (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||
else (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
file (WRITE svnversion.h.txt "#define SVNVERSION local\n")
|
||||
endif (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||
endif (Subversion_FOUND AND EXISTS "${SOURCE_DIR}/.svn")
|
||||
|
||||
# copy the file to the final header only if the version changes
|
||||
# reduces needless rebuilds
|
||||
|
@ -290,6 +290,7 @@ endif (NOT WSJT_QDEBUG_IN_RELEASE)
|
||||
|
||||
set_property (SOURCE ${all_C_and_CXXSRCS} APPEND PROPERTY COMPILE_FLAGS "-include wsjtx_config.h")
|
||||
set_property (SOURCE ${all_C_and_CXXSRCS} APPEND PROPERTY OBJECT_DEPENDS wsjtx_config.h)
|
||||
set_property (SOURCE ${all_C_and_CXXSRCS} APPEND PROPERTY OBJECT_DEPENDS svnversion.h)
|
||||
|
||||
if (WIN32)
|
||||
# generate the OmniRig COM interface source
|
||||
@ -485,6 +486,7 @@ function (QUERY_QMAKE VAR RESULT)
|
||||
file (TO_CMAKE_PATH "${output}" output)
|
||||
set (${RESULT} ${output} PARENT_SCOPE)
|
||||
endif (NOT return_code)
|
||||
message (STATUS "Asking qmake for ${RESULT} and got ${output}")
|
||||
endfunction (QUERY_QMAKE)
|
||||
|
||||
query_qmake (QT_INSTALL_PLUGINS QT_PLUGINS_DIR)
|
||||
@ -637,7 +639,7 @@ add_custom_target (uninstall
|
||||
|
||||
# creates svnversion.h using cmake script
|
||||
add_custom_target (revisiontag
|
||||
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/getsvn.cmake
|
||||
COMMAND ${CMAKE_COMMAND} -D SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -D OUTPUT_DIR=${PROJECT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/getsvn.cmake
|
||||
COMMENT "Generating Subversion revision information"
|
||||
VERBATIM
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user