Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
209bf80b
Commit
209bf80b
authored
14 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add mercurial versionning capabilities
parent
31464b5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMake/FindMercurial.cmake
+69
-0
69 additions, 0 deletions
CMake/FindMercurial.cmake
CMakeLists.txt
+11
-4
11 additions, 4 deletions
CMakeLists.txt
with
80 additions
and
4 deletions
CMake/FindMercurial.cmake
0 → 100644
+
69
−
0
View file @
209bf80b
# - Extract information from a mercurial working copy
# Example usage:
# FIND_PACKAGE(Mercurial)
# IF(Mercurial_FOUND)
# Mercurial_WC_IDENTIFY(${PROJECT_SOURCE_DIR} Project)
# MESSAGE("Current revision is ${Project_WC_REVISION}")
# MESSAGE("Mercurial version is ${Mercurial_VERSION_HG}")
# ENDIF(Mercurial_FOUND)
SET
(
Mercurial_FOUND FALSE
)
SET
(
Mercurial_HG_FOUND FALSE
)
FIND_PROGRAM
(
Mercurial_HG_EXECUTABLE hg
DOC
"mercurial command line client"
)
MARK_AS_ADVANCED
(
Mercurial_HG_EXECUTABLE
)
IF
(
Mercurial_HG_EXECUTABLE
)
SET
(
Mercurial_HG_FOUND TRUE
)
SET
(
Mercurial_FOUND TRUE
)
MACRO
(
Mercurial_WC_IDENTIFY dir prefix
)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
SET
(
_Mercurial_SAVED_LC_ALL
"$ENV{LC_ALL}"
)
SET
(
ENV{LC_ALL} C
)
EXECUTE_PROCESS
(
COMMAND
${
Mercurial_HG_EXECUTABLE
}
version
WORKING_DIRECTORY
${
dir
}
OUTPUT_VARIABLE Mercurial_VERSION_HG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS
(
COMMAND
${
Mercurial_HG_EXECUTABLE
}
identify
${
dir
}
OUTPUT_VARIABLE
${
prefix
}
_WC_IDENTIFY
ERROR_VARIABLE Mercurial_hg_identify_error
RESULT_VARIABLE Mercurial_hg_identify_result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF
(
NOT
${
Mercurial_hg_identify_result
}
EQUAL 0
)
MESSAGE
(
SEND_ERROR
"Command
\"
${
Mercurial_HG_EXECUTABLE
}
identify
${
dir
}
\"
failed with output:
\n
${
Mercurial_hg_identify_error
}
"
)
ELSE
(
NOT
${
Mercurial_hg_identify_result
}
EQUAL 0
)
STRING
(
REGEX REPLACE
"^(.*
\n
)?Mercurial Distributed SCM [(]version ([.0-9]+).*"
"
\\
2"
Mercurial_VERSION_HG
"
${
Mercurial_VERSION_HG
}
"
)
STRING
(
REGEX REPLACE
"^(.*
\n
)?([0-9a-f]+).*"
"
\\
2"
${
prefix
}
_WC_REVISION
"
${${
prefix
}
_WC_IDENTIFY
}
"
)
ENDIF
(
NOT
${
Mercurial_hg_identify_result
}
EQUAL 0
)
# restore the previous LC_ALL
SET
(
ENV{LC_ALL}
${
_Mercurial_SAVED_LC_ALL
}
)
ENDMACRO
(
Mercurial_WC_IDENTIFY
)
ENDIF
(
Mercurial_HG_EXECUTABLE
)
IF
(
NOT Mercurial_FOUND
)
IF
(
NOT Mercurial_FIND_QUIETLY
)
MESSAGE
(
STATUS
"Mercurial was not found."
)
ELSE
(
NOT Mercurial_FIND_QUIETLY
)
IF
(
Mercurial_FIND_REQUIRED
)
MESSAGE
(
FATAL_ERROR
"Mercurial was not found."
)
ENDIF
(
Mercurial_FIND_REQUIRED
)
ENDIF
(
NOT Mercurial_FIND_QUIETLY
)
ENDIF
(
NOT Mercurial_FOUND
)
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
11
−
4
View file @
209bf80b
...
...
@@ -70,10 +70,17 @@ SET(OTB_VERSION_MAJOR "3")
SET
(
OTB_VERSION_MINOR
"2"
)
SET
(
OTB_VERSION_PATCH
"1"
)
# Version string should not include patch level. The major.minor is
# enough to distinguish available features of the toolkit.
SET
(
OTB_VERSION_STRING
"
${
OTB_VERSION_MAJOR
}
.
${
OTB_VERSION_MINOR
}
.
${
OTB_VERSION_PATCH
}
"
)
FIND_PACKAGE
(
Mercurial
)
IF
(
Mercurial_FOUND
)
Mercurial_WC_IDENTIFY
(
${
PROJECT_SOURCE_DIR
}
OTB
)
MESSAGE
(
"Mercurial version is
${
Mercurial_VERSION_HG
}
"
)
MESSAGE
(
"Repository revision is
${
Project_WC_REVISION
}
"
)
SET
(
OTB_VERSION_STRING
"
${
OTB_VERSION_MAJOR
}
.
${
OTB_VERSION_MINOR
}
.
${
OTB_VERSION_PATCH
}
.
${
Project_WC_REVISION
}
"
)
ELSE
(
Mercurial_FOUND
)
# Version string should not include patch level. The major.minor is
# enough to distinguish available features of the toolkit.
SET
(
OTB_VERSION_STRING
"
${
OTB_VERSION_MAJOR
}
.
${
OTB_VERSION_MINOR
}
.
${
OTB_VERSION_PATCH
}
"
)
ENDIF
(
Mercurial_FOUND
)
OPTION
(
BUILD_TESTING
"Build testing."
OFF
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment