Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #348 from dawagner/windows-nice-fileversion
Browse files Browse the repository at this point in the history
Windows/Resource.rc: use user-provided version as "nice" file version

There are two instances of FileVersion (resp. ProductVersion): a numerical one
and a literal one. If the user forced a version string, use it as-is as the
literal one.
  • Loading branch information
krocard committed Feb 4, 2016
2 parents 58f1451 + ae6f63f commit 4d3b719
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions SetVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Fallback values:
set(PF_VERSION_MAJOR 0 CACHE INTERNAL "Parameter Framework's version major number")
set(PF_VERSION_MINOR 0 CACHE INTERNAL "Parameter Framework's version minor number")
set(PF_VERSION_PATCH 0 CACHE INTERNAL "Parameter Framework's version patch number")
set(PF_VERSION_TWEAK 0 CACHE INTERNAL "Parameter Framework's version tweak (or build) number")
set(PF_VERSION_SHA1 "g0000000000" CACHE INTERNAL "Parameter Framework's sources git SHA1")
set(PF_VERSION_DIRTY "" CACHE INTERNAL "Parameter Framework's sources dirty marker")
set(PF_VERSION_MAJOR 0)
set(PF_VERSION_MINOR 0)
set(PF_VERSION_PATCH 0)
set(PF_VERSION_TWEAK 0)
set(PF_VERSION_SHA1 "g0000000000")
set(PF_VERSION_DIRTY "")

# Find and set the Parameter Framework's version
# First, let's see if the user forced a version (i.e. "vX.Y.Z-N")
Expand All @@ -55,6 +55,9 @@ if(NOT DEFINED PF_VERSION)
set(PF_VERSION "${CMAKE_MATCH_1}-0")
endif()
endif()
else()
# Set the "nice version string" to the one forced by the user
set(NICE_PF_VERSION "${PF_VERSION}")
endif()

# Parse the version number to extract the various fields
Expand All @@ -68,8 +71,8 @@ if(PF_VERSION MATCHES ${REGEX})
set(PF_VERSION_DIRTY ${CMAKE_MATCH_8}) # Skip the 7th: it is a superset of the 8th
endif()

# If we are precisely on a tag, make a nicer version string
set(NICE_PF_VERSION "${PF_VERSION}" CACHE INTERNAL "")
if((PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
# If we are precisely on a tag, make a nicer version string (unless otherwise
# forced by the user - see above)
if((NOT DEFINED NICE_PF_VERSION) AND (PF_VERSION_TWEAK EQUAL 0) AND (NOT PF_VERSION_DIRTY))
set(NICE_PF_VERSION "v${PF_VERSION_MAJOR}.${PF_VERSION_MINOR}.${PF_VERSION_PATCH}")
endif()
4 changes: 2 additions & 2 deletions support/windows/Resource.rc.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Intel Corporation"
VALUE "FileDescription", "@WINRC_FILE_DESCRIPTION@"
VALUE "FileVersion", "v@WINRC_MAJOR@.@WINRC_MINOR@.@WINRC_PATCH@.@WINRC_TWEAK@"
VALUE "FileVersion", "@NICE_PF_VERSION@"
VALUE "InternalName", WINRC_FILENAME
VALUE "LegalCopyright", "Copyright (c) 2011-2016 Intel Corporation"
VALUE "OriginalFilename", WINRC_FILENAME
VALUE "ProductName", "Parameter Framework"
VALUE "ProductVersion", "v@WINRC_MAJOR@.@WINRC_MINOR@.@WINRC_PATCH@.@WINRC_TWEAK@"
VALUE "ProductVersion", "@NICE_PF_VERSION@"
END
END
BLOCK "VarFileInfo"
Expand Down

0 comments on commit 4d3b719

Please sign in to comment.