Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
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
spdlog
Commits
30bd80bd
Commit
30bd80bd
authored
May 29, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake improvements
parent
5709cb10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
24 deletions
+44
-24
CMakeLists.txt
CMakeLists.txt
+27
-9
bench/CMakeLists.txt
bench/CMakeLists.txt
+1
-2
example/CMakeLists.txt
example/CMakeLists.txt
+2
-8
tests/CMakeLists.txt
tests/CMakeLists.txt
+14
-5
No files found.
CMakeLists.txt
View file @
30bd80bd
...
...
@@ -3,18 +3,17 @@
cmake_minimum_required
(
VERSION 3.1
)
project
(
spdlog VERSION 1.3.1 LANGUAGES CXX
)
include
(
CMakeDependentOption
)
include
(
GNUInstallDirs
)
#---------------------------------------------------------------------------------------
#
s
et default build to release
#
S
et default build to release
#---------------------------------------------------------------------------------------
if
(
NOT CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE
"Release"
CACHE STRING
"Choose Release or Debug"
FORCE
)
endif
()
#---------------------------------------------------------------------------------------
#
c
ompiler config
#
C
ompiler config
#---------------------------------------------------------------------------------------
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
...
...
@@ -35,6 +34,7 @@ endif ()
option
(
SPDLOG_BUILD_EXAMPLES
"Build examples"
ON
)
option
(
SPDLOG_BUILD_BENCH
"Build benchmarks (Requires https://github.com/google/benchmark.git to be installed)"
OFF
)
option
(
SPDLOG_BUILD_TESTS
"Build tests"
OFF
)
option
(
SPDLOG_BUILD_HO_TESTS
"Build tests using the header only version"
OFF
)
option
(
SPDLOG_INSTALL
"Generate the install target."
${
SPDLOG_MASTER_PROJECT
}
)
option
(
SPDLOG_FMT_EXTERNAL
"Use external fmt library instead of bundled"
OFF
)
...
...
@@ -42,27 +42,46 @@ message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
find_package
(
Threads REQUIRED
)
#---------------------------------------------------------------------------------------
# IDE support for headers
#---------------------------------------------------------------------------------------
set
(
SPDLOG_HEADERS_DIR
"
${
CMAKE_CURRENT_LIST_DIR
}
/include"
)
file
(
GLOB SPDLOG_TOP_HEADERS
"
${
SPDLOG_HEADERS_DIR
}
/spdlog/*.h"
)
file
(
GLOB SPDLOG_DETAILS_HEADERS
"
${
SPDLOG_HEADERS_DIR
}
/spdlog/details/*.h"
)
file
(
GLOB SPDLOG_SINKS_HEADERS
"
${
SPDLOG_HEADERS_DIR
}
/spdlog/sinks/*.h"
)
file
(
GLOB SPDLOG_FMT_HEADERS
"
${
SPDLOG_HEADERS_DIR
}
/spdlog/fmt/*.h"
)
file
(
GLOB SPDLOG_FMT_BUNDELED_HEADERS
"
${
SPDLOG_HEADERS_DIR
}
/spdlog/fmt/bundled/*.h"
)
set
(
SPDLOG_ALL_HEADERS
${
SPDLOG_TOP_HEADERS
}
${
SPDLOG_DETAILS_HEADERS
}
${
SPDLOG_SINKS_HEADERS
}
${
SPDLOG_FMT_HEADERS
}
${
SPDLOG_FMT_BUNDELED_HEADERS
}
)
source_group
(
"Header Files
\\
spdlog"
FILES
${
SPDLOG_TOP_HEADERS
}
)
source_group
(
"Header Files
\\
spdlog
\\
details"
FILES
${
SPDLOG_DETAILS_HEADERS
}
)
source_group
(
"Header Files
\\
spdlog
\\
sinks"
FILES
${
SPDLOG_SINKS_HEADERS
}
)
source_group
(
"Header Files
\\
spdlog
\\
fmt"
FILES
${
SPDLOG_FMT_HEADERS
}
)
source_group
(
"Header Files
\\
spdlog
\\
fmt
\\
bundled
\\
"
FILES
${
SPDLOG_FMT_BUNDELED_HEADERS
}
)
#---------------------------------------------------------------------------------------
# Static library version
#---------------------------------------------------------------------------------------
add_library
(
spdlog STATIC src/spdlog.cpp
)
add_library
(
spdlog STATIC src/spdlog.cpp
${
SPDLOG_ALL_HEADERS
}
)
add_library
(
spdlog::spdlog ALIAS spdlog
)
target_compile_definitions
(
spdlog PUBLIC SPDLOG_COMPILED_LIB
)
target_include_directories
(
spdlog PUBLIC
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
target_link_libraries
(
spdlog PUBLIC Threads::Threads
)
#---------------------------------------------------------------------------------------
# Header only version
#---------------------------------------------------------------------------------------
add_library
(
spdlog_header_only INTERFACE
)
add_library
(
spdlog::spdlog_header_only ALIAS spdlog_header_only
)
target_include_directories
(
spdlog_header_only INTERFACE
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
target_link_libraries
(
spdlog_header_only INTERFACE Threads::Threads
)
#---------------------------------------------------------------------------------------
# Turn on compiler warnings and sanitizers if we build our own project
#---------------------------------------------------------------------------------------
...
...
@@ -146,5 +165,4 @@ if (SPDLOG_INSTALL)
#---------------------------------------------------------------------------------------
include
(
cmake/SpdlogCPack.cmake
)
endif
()
endif
()
\ No newline at end of file
bench/CMakeLists.txt
View file @
30bd80bd
...
...
@@ -2,7 +2,7 @@
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
cmake_minimum_required
(
VERSION 3.1
)
project
(
SpdlogB
ench CXX
)
project
(
spdlog_b
ench CXX
)
if
(
NOT TARGET spdlog
)
# Stand-alone build
...
...
@@ -21,7 +21,6 @@ target_link_libraries(async_bench PRIVATE spdlog::spdlog)
add_executable
(
latency latency.cpp
)
target_link_libraries
(
latency PRIVATE benchmark::benchmark spdlog::spdlog
)
add_executable
(
formatter-bench formatter-bench.cpp
)
target_link_libraries
(
formatter-bench PRIVATE benchmark::benchmark spdlog::spdlog
)
...
...
example/CMakeLists.txt
View file @
30bd80bd
...
...
@@ -2,15 +2,9 @@
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
cmake_minimum_required
(
VERSION 3.1
)
project
(
SpdlogE
xamples CXX
)
project
(
spdlog_e
xamples CXX
)
if
(
TARGET spdlog
)
# If we're running this example as part of the primary spdlog applciation
# then add an alias. This allows us to use the same "spdlog::spdlog"
# below that a user would use (with the namespace)
add_library
(
spdlog::spdlog ALIAS spdlog
)
add_library
(
spdlog::spdlog_header_only ALIAS spdlog_header_only
)
else
()
if
(
NOT TARGET spdlog
)
# Stand-alone build
find_package
(
spdlog REQUIRED
)
endif
()
...
...
tests/CMakeLists.txt
View file @
30bd80bd
...
...
@@ -15,10 +15,19 @@ set(SPDLOG_UTESTS_SOURCES
test_sink.h
test_fmt_helper.cpp
)
add_executable
(
spdlog-utests
${
SPDLOG_UTESTS_SOURCES
}
)
target_link_libraries
(
spdlog-utests spdlog
)
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/logs"
)
enable_testing
()
add_test
(
NAME spdlog-utests COMMAND spdlog-utests
)
# The compiled library tests
if
(
SPDLOG_BUILD_TESTS
)
add_executable
(
spdlog-utests
${
SPDLOG_UTESTS_SOURCES
}
)
target_link_libraries
(
spdlog-utests spdlog
)
add_test
(
NAME spdlog-utests COMMAND spdlog-utests
)
endif
()
# The header-only library version tests
if
(
SPDLOG_BUILD_HO_TESTS
)
add_executable
(
spdlog-utests-ho
${
SPDLOG_UTESTS_SOURCES
}
)
target_link_libraries
(
spdlog-utests-ho spdlog::spdlog_header_only
)
add_test
(
NAME spdlog-utests-ho COMMAND spdlog-utests-ho
)
endif
()
\ No newline at end of file
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