Skip to content

Commit

Permalink
4.2 standalone sources should compile even if svn is installed
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.kvirc.de/svn/tags/kvirc/4.2.0@6195 17fca916-40b9-46aa-a4ea-0a15b648b75c
  • Loading branch information
pragmaware committed Jul 2, 2012
1 parent 3bd9623 commit b2d817f
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SET(PACKAGE "kvirc")
SET(NICENAME "KVIrc")
SET(VERSION_MAJOR "4")
SET(VERSION_BRANCH "4.2")
SET(VERSION_RELEASE "4.2.0")
SET(VERSION_RELEASE "4.2.1")
SET(VERSION_CODENAME "Equilibrium")
# REMINDER: "Aria" is a candidate, trunk name "Quasar"

Expand Down Expand Up @@ -59,27 +59,44 @@ SET(MANUAL_REVISION
CACHE STRING "Manually set the revision number"
)



STRING(COMPARE EQUAL "${MANUAL_REVISION}" "" MANUAL_REVISION_UNSET)
IF(MANUAL_REVISION_UNSET)
# No manually forced revision number, gotta guess one now
FIND_PACKAGE(Subversion)
IF(Subversion_FOUND)
MESSAGE(STATUS "Found Subversion ${Subversion_VERSION_SVN}")
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} KVIrc)
IF(DEFINED KVIrc_WC_REVISION)
SET(CMAKE_KVIRC_BUILD_REVISION ${KVIrc_WC_REVISION})
MESSAGE(STATUS "Current revision is ${KVIrc_WC_REVISION}")
ELSE()
MESSAGE(STATUS "No Subversion working copy found")
ENDIF()
IF(EXISTS "${CMAKE_SOURCE_DIR}/.svnrevision")
# We're in a release package created using makedist.sh, so we should include a .svnrevision file
FILE(READ "${CMAKE_SOURCE_DIR}/.svnrevision" DISTSVNREVISION)
STRING(STRIP "${DISTSVNREVISION}" CMAKE_KVIRC_BUILD_REVISION)
MESSAGE(STATUS "SVN revision is ${CMAKE_KVIRC_BUILD_REVISION}")
ELSE()
IF(EXISTS "${CMAKE_SOURCE_DIR}/.svnrevision")
# We're in a release package created using makedist.sh, so we should include a .svnrevision file
FILE(READ "${CMAKE_SOURCE_DIR}/.svnrevision" DISTSVNREVISION)
STRING(STRIP "${DISTSVNREVISION}" CMAKE_KVIRC_BUILD_REVISION)
MESSAGE(STATUS "SVN revision is ${CMAKE_KVIRC_BUILD_REVISION}")
FIND_PACKAGE(Subversion)
IF(Subversion_FOUND)
MESSAGE(STATUS "Found Subversion ${Subversion_VERSION_SVN}")

# Subversion_WC_INFO is buggy and will croak if ran on a directory that is not checked out from svn

# SVN info does not like .. as paths, so be sure that we use a full path
GET_FILENAME_COMPONENT(ABS_FOLDER ${CMAKE_SOURCE_DIR} ABSOLUTE)
EXECUTE_PROCESS(
COMMAND ${Subversion_SVN_EXECUTABLE} info ${ABS_FOLDER}
RESULT_VARIABLE INFO_RESULT
OUTPUT_VARIABLE IGNORED
ERROR_VARIABLE IGNORED
)
IF(INFO_RESULT EQUAL 0)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} KVIrc)
IF(DEFINED KVIrc_WC_REVISION)
SET(CMAKE_KVIRC_BUILD_REVISION ${KVIrc_WC_REVISION})
MESSAGE(STATUS "Current revision is ${KVIrc_WC_REVISION}")
ELSE()
MESSAGE(STATUS "No revision number found (no clue why though).")
ENDIF()
ELSE()
MESSAGE(STATUS "No revision number found (not a subversion repository).")
ENDIF()
ELSE()
MESSAGE(STATUS "No revision number found.")
MESSAGE(STATUS "No revision number found (subversion not available).")
ENDIF()
ENDIF()

Expand Down

0 comments on commit b2d817f

Please sign in to comment.