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
5e1576f7
Commit
5e1576f7
authored
Apr 24, 2016
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cppformat -> fmt
parent
848ab63a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
39 deletions
+47
-39
CMakeLists.txt
CMakeLists.txt
+1
-1
cppformat/CMakeLists.txt
cppformat/CMakeLists.txt
+28
-19
doc/CMakeLists.txt
doc/CMakeLists.txt
+1
-2
support/cmake/fmt-config.cmake.in
support/cmake/fmt-config.cmake.in
+1
-1
test/CMakeLists.txt
test/CMakeLists.txt
+4
-4
test/add-subdirectory-test/CMakeLists.txt
test/add-subdirectory-test/CMakeLists.txt
+5
-5
test/find-package-test/CMakeLists.txt
test/find-package-test/CMakeLists.txt
+7
-7
No files found.
CMakeLists.txt
View file @
5e1576f7
...
...
@@ -2,7 +2,7 @@ message(STATUS "CMake version: ${CMAKE_VERSION}")
cmake_minimum_required
(
VERSION 2.8.12
)
# Determine if
cppforma
t is built as a subproject (using add_subdirectory)
# Determine if
fm
t is built as a subproject (using add_subdirectory)
# or if it is the master project.
set
(
MASTER_PROJECT OFF
)
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
...
...
cppformat/CMakeLists.txt
View file @
5e1576f7
# Define the
cppforma
t library, its includes and the needed defines.
# Define the
fm
t library, its includes and the needed defines.
# format.cc is added to FMT_HEADERS for the header-only configuration.
set
(
FMT_HEADERS format.h format.cc
)
if
(
HAVE_OPEN
)
...
...
@@ -6,38 +6,44 @@ if (HAVE_OPEN)
set
(
FMT_SOURCES
${
FMT_SOURCES
}
posix.cc
)
endif
()
add_library
(
cppformat
${
FMT_SOURCES
}
${
FMT_HEADERS
}
)
add_library
(
fmt
${
FMT_SOURCES
}
${
FMT_HEADERS
}
)
option
(
FMT_CPPFORMAT
"Build cppformat library for backward compatibility."
OFF
)
if
(
FMT_CPPFORMAT
)
message
(
WARNING
"The cppformat library is deprecated, use fmt instead."
)
add_library
(
cppformat
${
FMT_SOURCES
}
${
FMT_HEADERS
}
)
endif
()
# Starting with cmake 3.1 the CXX_STANDARD property can be used instead.
target_compile_options
(
cppforma
t PUBLIC
${
CPP11_FLAG
}
)
target_compile_options
(
fm
t PUBLIC
${
CPP11_FLAG
}
)
if
(
FMT_PEDANTIC
)
target_compile_options
(
cppforma
t PRIVATE
${
PEDANTIC_COMPILE_FLAGS
}
)
target_compile_options
(
fm
t PRIVATE
${
PEDANTIC_COMPILE_FLAGS
}
)
endif
()
target_include_directories
(
cppforma
t INTERFACE
target_include_directories
(
fm
t INTERFACE
$<BUILD_INTERFACE:
${
PROJECT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
cppforma
t PROPERTIES
set_target_properties
(
fm
t PROPERTIES
VERSION
${
FMT_VERSION
}
SOVERSION
${
CPACK_PACKAGE_VERSION_MAJOR
}
)
if
(
BUILD_SHARED_LIBS
)
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
(
cppforma
t -Wl,--as-needed
)
target_link_libraries
(
fm
t -Wl,--as-needed
)
endif
()
target_compile_definitions
(
cppforma
t PRIVATE FMT_EXPORT INTERFACE FMT_SHARED
)
target_compile_definitions
(
fm
t PRIVATE FMT_EXPORT INTERFACE FMT_SHARED
)
endif
()
#------------------------------------------------------------------------------
# additionally define a header only library when cmake is new enough
if
(
CMAKE_VERSION VERSION_GREATER 3.1.0 OR CMAKE_VERSION VERSION_EQUAL 3.1.0
)
add_library
(
cppforma
t-header-only INTERFACE
)
add_library
(
fm
t-header-only INTERFACE
)
target_compile_definitions
(
cppforma
t-header-only INTERFACE FMT_HEADER_ONLY=1
)
target_compile_definitions
(
fm
t-header-only INTERFACE FMT_HEADER_ONLY=1
)
target_include_directories
(
cppforma
t-header-only INTERFACE
target_include_directories
(
fm
t-header-only INTERFACE
$<BUILD_INTERFACE:
${
PROJECT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
endif
()
...
...
@@ -45,15 +51,15 @@ endif ()
# Install targets.
if
(
FMT_INSTALL
)
include
(
CMakePackageConfigHelpers
)
set
(
FMT_CMAKE_DIR lib/cmake/
cppforma
t CACHE STRING
set
(
FMT_CMAKE_DIR lib/cmake/
fm
t CACHE STRING
"Installation directory for cmake files, relative to
${
CMAKE_INSTALL_PREFIX
}
."
)
set
(
version_config
${
PROJECT_BINARY_DIR
}
/
cppforma
t-config-version.cmake
)
set
(
project_config
${
PROJECT_BINARY_DIR
}
/
cppforma
t-config.cmake
)
set
(
targets_export_name
cppforma
t-targets
)
set
(
version_config
${
PROJECT_BINARY_DIR
}
/
fm
t-config-version.cmake
)
set
(
project_config
${
PROJECT_BINARY_DIR
}
/
fm
t-config.cmake
)
set
(
targets_export_name
fm
t-targets
)
set
(
INSTALL_TARGETS
cppforma
t
)
if
(
TARGET
cppforma
t-header-only
)
set
(
INSTALL_TARGETS
${
INSTALL_TARGETS
}
cppforma
t-header-only
)
set
(
INSTALL_TARGETS
fm
t
)
if
(
TARGET
fm
t-header-only
)
set
(
INSTALL_TARGETS
${
INSTALL_TARGETS
}
fm
t-header-only
)
endif
()
set
(
FMT_LIB_DIR lib CACHE STRING
...
...
@@ -65,7 +71,7 @@ if (FMT_INSTALL)
VERSION
${
FMT_VERSION
}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file
(
${
PROJECT_SOURCE_DIR
}
/support/cmake/
cppforma
t-config.cmake.in
${
PROJECT_SOURCE_DIR
}
/support/cmake/
fm
t-config.cmake.in
${
project_config
}
INSTALL_DESTINATION
${
FMT_CMAKE_DIR
}
)
export
(
TARGETS
${
INSTALL_TARGETS
}
FILE
${
PROJECT_BINARY_DIR
}
/
${
targets_export_name
}
.cmake
)
...
...
@@ -79,4 +85,7 @@ if (FMT_INSTALL)
# Install the library and headers.
install
(
TARGETS
${
INSTALL_TARGETS
}
EXPORT
${
targets_export_name
}
DESTINATION
${
FMT_LIB_DIR
}
)
install
(
FILES
${
FMT_HEADERS
}
DESTINATION include/cppformat
)
if
(
FMT_CPPFORMAT
)
install
(
TARGETS cppformat DESTINATION
${
FMT_LIB_DIR
}
)
endif
()
endif
()
doc/CMakeLists.txt
View file @
5e1576f7
...
...
@@ -7,5 +7,4 @@ endif ()
add_custom_target
(
doc
COMMAND
${
CMAKE_CURRENT_SOURCE_DIR
}
/build.py
${
FMT_VERSION
}
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/html/
DESTINATION share/doc/cppformat
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/html/ DESTINATION share/doc/fmt
)
support/cmake/
cppforma
t-config.cmake.in
→
support/cmake/
fm
t-config.cmake.in
View file @
5e1576f7
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
check_required_components(
cppforma
t)
check_required_components(
fm
t)
test/CMakeLists.txt
View file @
5e1576f7
...
...
@@ -39,7 +39,7 @@ set(TEST_MAIN_SRC test-main.cc gtest-extra.cc gtest-extra.h util.cc)
add_library
(
test-main STATIC
${
TEST_MAIN_SRC
}
)
target_compile_definitions
(
test-main PUBLIC
FMT_USE_FILE_DESCRIPTORS=$<BOOL:
${
HAVE_OPEN
}
>
)
target_link_libraries
(
test-main gmock
cppforma
t
)
target_link_libraries
(
test-main gmock
fm
t
)
include
(
CheckCXXCompilerFlag
)
...
...
@@ -97,8 +97,8 @@ endif ()
add_executable
(
header-only-test
header-only-test.cc header-only-test2.cc test-main.cc
)
target_link_libraries
(
header-only-test gmock
)
if
(
TARGET
cppforma
t-header-only
)
target_link_libraries
(
header-only-test
cppforma
t-header-only
)
if
(
TARGET
fm
t-header-only
)
target_link_libraries
(
header-only-test
fm
t-header-only
)
else
()
target_include_directories
(
header-only-test PRIVATE
${
PROJECT_SOURCE_DIR
}
)
target_compile_definitions
(
header-only-test PRIVATE FMT_HEADER_ONLY=1
)
...
...
@@ -133,7 +133,7 @@ if (FMT_PEDANTIC)
"
${
CMAKE_CURRENT_BINARY_DIR
}
/find-package-test"
--build-generator
${
CMAKE_GENERATOR
}
--build-makeprogram
${
CMAKE_MAKE_PROGRAM
}
--build-options
"-D
cppformat
_DIR=
${
PROJECT_BINARY_DIR
}
"
--build-options
"-D
FMT
_DIR=
${
PROJECT_BINARY_DIR
}
"
"-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
"
)
# test if the targets are findable when add_subdirectory is used
...
...
test/add-subdirectory-test/CMakeLists.txt
View file @
5e1576f7
cmake_minimum_required
(
VERSION 2.8.12
)
project
(
cppforma
t-test
)
project
(
fm
t-test
)
add_subdirectory
(
../..
cppforma
t
)
add_subdirectory
(
../..
fm
t
)
add_executable
(
library-test
"main.cc"
)
target_link_libraries
(
library-test
cppforma
t
)
target_link_libraries
(
library-test
fm
t
)
if
(
TARGET
cppforma
t-header-only
)
if
(
TARGET
fm
t-header-only
)
add_executable
(
header-only-test
"main.cc"
)
target_link_libraries
(
header-only-test
cppforma
t-header-only
)
target_link_libraries
(
header-only-test
fm
t-header-only
)
endif
()
test/find-package-test/CMakeLists.txt
View file @
5e1576f7
cmake_minimum_required
(
VERSION 2.8.12
)
project
(
cppforma
t-test
)
project
(
fm
t-test
)
find_package
(
cppformat
REQUIRED
)
find_package
(
FMT
REQUIRED
)
add_executable
(
library-test
"main.cc"
)
target_link_libraries
(
library-test
cppforma
t
)
add_executable
(
library-test
main.cc
)
target_link_libraries
(
library-test
fm
t
)
if
(
TARGET
cppforma
t-header-only
)
add_executable
(
header-only-test
"main.cc"
)
target_link_libraries
(
header-only-test
cppforma
t-header-only
)
if
(
TARGET
fm
t-header-only
)
add_executable
(
header-only-test
main.cc
)
target_link_libraries
(
header-only-test
fm
t-header-only
)
endif
()
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