Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
f5b1c16e
Commit
f5b1c16e
authored
Nov 07, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add version macro FMT_VERSION (#411)
parent
cfd00af3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
CMakeLists.txt
CMakeLists.txt
+22
-8
fmt/format.h
fmt/format.h
+3
-0
No files found.
CMakeLists.txt
View file @
f5b1c16e
...
@@ -9,12 +9,22 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
...
@@ -9,12 +9,22 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set
(
MASTER_PROJECT ON
)
set
(
MASTER_PROJECT ON
)
endif
()
endif
()
# Joins arguments and places the results in ${result_var}.
function
(
join result_var
)
set
(
result
)
foreach
(
arg
${
ARGN
}
)
set
(
result
"
${
result
}${
arg
}
"
)
endforeach
()
set
(
${
result_var
}
"
${
result
}
"
PARENT_SCOPE
)
endfunction
()
# Set the default CMAKE_BUILD_TYPE to Release.
# Set the default CMAKE_BUILD_TYPE to Release.
# This should be done before the project command since the latter can set
# This should be done before the project command since the latter can set
# CMAKE_BUILD_TYPE itself (it does so for nmake).
# CMAKE_BUILD_TYPE itself (it does so for nmake).
if
(
NOT CMAKE_BUILD_TYPE
)
if
(
NOT CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE Release CACHE STRING
join
(
doc
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or "
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
)
"CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
)
set
(
CMAKE_BUILD_TYPE Release CACHE STRING
${
doc
}
)
endif
()
endif
()
option
(
FMT_PEDANTIC
"Enable extra warnings and expensive tests."
OFF
)
option
(
FMT_PEDANTIC
"Enable extra warnings and expensive tests."
OFF
)
...
@@ -28,13 +38,17 @@ option(FMT_USE_CPP11 "Enable the addition of C++11 compiler flags." ON)
...
@@ -28,13 +38,17 @@ option(FMT_USE_CPP11 "Enable the addition of C++11 compiler flags." ON)
project
(
FMT
)
project
(
FMT
)
# Starting with cmake 3.0 VERSION is part of the project command.
# Starting with cmake 3.0 VERSION is part of the project command.
set
(
FMT_VERSION 3.1.0
)
file
(
READ fmt/format.h format_h
)
if
(
NOT
FMT_VERSION MATCHES
"^([0-9]+).([0-9]+).([0-9]+)$
"
)
if
(
NOT
format_h MATCHES
"FMT_VERSION ([0-9]+)([0-9][0-9])([0-9][0-9])
"
)
message
(
FATAL_ERROR
"
Invalid version format
${
FMT_VERSION
}
."
)
message
(
FATAL_ERROR
"
Cannot get FMT_VERSION from format.h
."
)
endif
()
endif
()
set
(
CPACK_PACKAGE_VERSION_MAJOR
${
CMAKE_MATCH_1
}
)
# Use math to skip leading zeros if any.
set
(
CPACK_PACKAGE_VERSION_MINOR
${
CMAKE_MATCH_2
}
)
math
(
EXPR CPACK_PACKAGE_VERSION_MAJOR
${
CMAKE_MATCH_1
}
)
set
(
CPACK_PACKAGE_VERSION_PATCH
${
CMAKE_MATCH_3
}
)
math
(
EXPR CPACK_PACKAGE_VERSION_MINOR
${
CMAKE_MATCH_2
}
)
math
(
EXPR CPACK_PACKAGE_VERSION_PATCH
${
CMAKE_MATCH_3
}
)
join
(
FMT_VERSION
${
CPACK_PACKAGE_VERSION_MAJOR
}
.
${
CPACK_PACKAGE_VERSION_MINOR
}
.
${
CPACK_PACKAGE_VERSION_PATCH
}
)
message
(
STATUS
"Version:
${
FMT_VERSION
}
"
)
message
(
STATUS
"Build type:
${
CMAKE_BUILD_TYPE
}
"
)
message
(
STATUS
"Build type:
${
CMAKE_BUILD_TYPE
}
"
)
...
...
fmt/format.h
View file @
f5b1c16e
...
@@ -40,6 +40,9 @@
...
@@ -40,6 +40,9 @@
#include <vector>
#include <vector>
#include <utility>
#include <utility>
// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 30002
#ifdef _SECURE_SCL
#ifdef _SECURE_SCL
# define FMT_SECURE_SCL _SECURE_SCL
# define FMT_SECURE_SCL _SECURE_SCL
#else
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment