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
1cba0aea
Commit
1cba0aea
authored
Dec 10, 2015
by
vitaut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify CMake config and do minor adjustments
for consistency with used coding conventions.
parent
a9d2e826
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
30 deletions
+30
-30
CMakeLists.txt
CMakeLists.txt
+10
-14
format.h
format.h
+11
-9
test/CMakeLists.txt
test/CMakeLists.txt
+9
-7
No files found.
CMakeLists.txt
View file @
1cba0aea
...
...
@@ -94,20 +94,20 @@ if (BIICODE)
return
()
endif
()
add_library
(
cppformat
${
FMT_SOURCES
}
)
if
(
BUILD_SHARED_LIBS
)
add_library
(
cppformat SHARED
${
FMT_SOURCES
}
)
if
(
UNIX AND NOT APPLE
)
# Fix rpmlint warning:
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
target_link_libraries
(
cppformat -Wl,--as-needed
)
endif
()
else
()
add_library
(
cppformat
${
FMT_SOURCES
}
)
endif
()
if
(
UNIX AND NOT APPLE
)
# Fix rpmlint warning:
# unused-direct-shlib-dependency /usr/lib/libformat.so.1.1.0 /lib/libm.so.6.
target_link_libraries
(
cppformat -Wl,--as-needed
)
endif
()
set
(
FMT_EXTRA_COMPILE_FLAGS -DFMT_EXPORT
)
endif
()
if
(
FMT_PEDANTIC AND
(
CMAKE_COMPILER_IS_GNUCXX
OR
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)))
set
(
FMT_EXTRA_COMPILE_FLAGS
"-Wall -Wextra -Wshadow -pedantic"
)
set
(
FMT_EXTRA_COMPILE_FLAGS
"
${
FMT_EXTRA_COMPILE_FLAGS
}
-Wall -Wextra -Wshadow -pedantic"
)
endif
()
# If FMT_PEDANTIC is TRUE, then test compilation with both -std=c++11
...
...
@@ -119,10 +119,6 @@ if (CPP11_FLAG AND FMT_PEDANTIC)
set
(
FMT_TEST_DEFAULT_FLAGS TRUE
)
endif
()
if
(
BUILD_SHARED_LIBS
)
set
(
FMT_EXTRA_COMPILE_FLAGS
"
${
FMT_EXTRA_COMPILE_FLAGS
}
-DFMT_EXPORT"
)
endif
()
set_target_properties
(
cppformat
PROPERTIES COMPILE_FLAGS
"
${
FMT_EXTRA_COMPILE_FLAGS
}
"
)
...
...
format.h
View file @
1cba0aea
...
...
@@ -64,15 +64,14 @@ typedef long long intmax_t;
# include <iterator>
#endif
#if !defined(FMT_HEADER_ONLY) &&
(defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
)
#if !defined(FMT_HEADER_ONLY) &&
defined(_WIN32
)
# ifdef FMT_EXPORT
# define FMT_API __declspec(dllexport)
# elif defined(FMT_SHARED)
# define FMT_API __declspec(dllimport)
# else
# define FMT_API
# endif
#else
#endif
#ifndef FMT_API
# define FMT_API
#endif
...
...
@@ -903,11 +902,11 @@ class UTF16ToUTF8 {
};
FMT_API
void
format_windows_error
(
fmt
::
Writer
&
out
,
int
error_code
,
fmt
::
StringRef
message
)
FMT_NOEXCEPT
;
fmt
::
StringRef
message
)
FMT_NOEXCEPT
;
#endif
FMT_API
void
format_system_error
(
fmt
::
Writer
&
out
,
int
error_code
,
fmt
::
StringRef
message
)
FMT_NOEXCEPT
;
fmt
::
StringRef
message
)
FMT_NOEXCEPT
;
// A formatting argument value.
struct
Value
{
...
...
@@ -1836,7 +1835,8 @@ class PrintfFormatter : private FormatterBase {
public:
explicit
PrintfFormatter
(
const
ArgList
&
args
)
:
FormatterBase
(
args
)
{}
FMT_API
void
format
(
BasicWriter
<
Char
>
&
writer
,
BasicCStringRef
<
Char
>
format_str
);
FMT_API
void
format
(
BasicWriter
<
Char
>
&
writer
,
BasicCStringRef
<
Char
>
format_str
);
};
}
// namespace internal
...
...
@@ -2941,7 +2941,8 @@ void format(BasicFormatter<Char> &f, const Char *&format_str, const T &value) {
// Reports a system error without throwing an exception.
// Can be used to report errors from destructors.
FMT_API
void
report_system_error
(
int
error_code
,
StringRef
message
)
FMT_NOEXCEPT
;
FMT_API
void
report_system_error
(
int
error_code
,
StringRef
message
)
FMT_NOEXCEPT
;
#if FMT_USE_WINDOWS_H
...
...
@@ -2987,7 +2988,8 @@ class WindowsError : public SystemError {
// Reports a Windows error without throwing an exception.
// Can be used to report errors from destructors.
FMT_API
void
report_windows_error
(
int
error_code
,
StringRef
message
)
FMT_NOEXCEPT
;
FMT_API
void
report_windows_error
(
int
error_code
,
StringRef
message
)
FMT_NOEXCEPT
;
#endif
...
...
test/CMakeLists.txt
View file @
1cba0aea
...
...
@@ -2,9 +2,13 @@ set(FMT_GMOCK_DIR ../gmock)
include_directories
(
..
${
FMT_GMOCK_DIR
}
)
if
(
BUILD_SHARED_LIBS
)
set
(
FMT_IMPORT
"-DFMT_SHARED"
)
endif
()
# Links target with cppformat and any libraries passed as extra arguments.
function
(
target_link_cppformat target
)
target_link_libraries
(
${
target
}
cppformat
${
ARGN
}
)
if
(
BUILD_SHARED_LIBS
)
set_target_properties
(
${
target
}
PROPERTIES COMPILE_FLAGS -DFMT_SHARED
)
endif
()
endfunction
()
# We compile Google Test ourselves instead of using pre-compiled libraries.
# See the Google Test FAQ "Why is it not recommended to install a
...
...
@@ -49,8 +53,7 @@ endif ()
set
(
TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc
)
add_library
(
test-main STATIC
${
TEST_MAIN_SRC
}
)
set_target_properties
(
test-main PROPERTIES COMPILE_FLAGS
"
${
FMT_IMPORT
}
"
)
target_link_libraries
(
test-main cppformat gmock
)
target_link_cppformat
(
test-main gmock
)
# Adds a test.
# Usage: add_fmt_test(name [CUSTOM_LINK] srcs...)
...
...
@@ -59,8 +62,7 @@ function(add_fmt_test name)
add_executable
(
${
name
}
${
name
}
.cc
${
add_fmt_test_UNPARSED_ARGUMENTS
}
)
target_link_libraries
(
${
name
}
test-main
)
if
(
NOT add_fmt_test_CUSTOM_LINK
)
set_target_properties
(
${
name
}
PROPERTIES COMPILE_FLAGS
"
${
FMT_IMPORT
}
"
)
target_link_libraries
(
${
name
}
cppformat
)
target_link_cppformat
(
${
name
}
)
endif
()
add_test
(
NAME
${
name
}
COMMAND
${
name
}
)
endfunction
()
...
...
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