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
3315bad0
Commit
3315bad0
authored
Jul 10, 2021
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat wall warnings as errors if SPDLOG_BUILD_WARNINGS is ON
parent
3eeced78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
cmake/utils.cmake
cmake/utils.cmake
+23
-22
No files found.
cmake/utils.cmake
View file @
3315bad0
...
...
@@ -2,21 +2,21 @@
function
(
spdlog_extract_version
)
file
(
READ
"
${
CMAKE_CURRENT_LIST_DIR
}
/include/spdlog/version.h"
file_contents
)
string
(
REGEX MATCH
"SPDLOG_VER_MAJOR ([0-9]+)"
_
"
${
file_contents
}
"
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
message
(
FATAL_ERROR
"Could not extract major version number from spdlog/version.h"
)
endif
()
endif
()
set
(
ver_major
${
CMAKE_MATCH_1
}
)
string
(
REGEX MATCH
"SPDLOG_VER_MINOR ([0-9]+)"
_
"
${
file_contents
}
"
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
message
(
FATAL_ERROR
"Could not extract minor version number from spdlog/version.h"
)
endif
()
endif
()
set
(
ver_minor
${
CMAKE_MATCH_1
}
)
string
(
REGEX MATCH
"SPDLOG_VER_PATCH ([0-9]+)"
_
"
${
file_contents
}
"
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
if
(
NOT CMAKE_MATCH_COUNT EQUAL 1
)
message
(
FATAL_ERROR
"Could not extract patch version number from spdlog/version.h"
)
endif
()
endif
()
set
(
ver_patch
${
CMAKE_MATCH_1
}
)
set
(
SPDLOG_VERSION_MAJOR
${
ver_major
}
PARENT_SCOPE
)
...
...
@@ -27,31 +27,32 @@ endfunction()
# Turn on warnings on the given target
function
(
spdlog_enable_warnings target_name
)
if
(
SPDLOG_BUILD_WARNINGS
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"MSVC"
)
if
(
SPDLOG_BUILD_WARNINGS
)
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"MSVC"
)
list
(
APPEND MSVC_OPTIONS
"/W3"
)
if
(
MSVC_VERSION GREATER 1900
)
# Allow non fatal security warnings for msvc 2015
if
(
MSVC_VERSION GREATER 1900
)
# Allow non fatal security warnings for msvc 2015
list
(
APPEND MSVC_OPTIONS
"/WX"
)
endif
()
endif
()
endif
()
endif
()
target_compile_options
(
${
target_name
}
PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wconversion
-pedantic
-Wfatal-errors>
$<$<CXX_COMPILER_ID:MSVC>:
${
MSVC_OPTIONS
}
>
)
endif
()
${
target_name
}
PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wconversion
-pedantic
-Werror
-Wfatal-errors>
$<$<CXX_COMPILER_ID:MSVC>:
${
MSVC_OPTIONS
}
>
)
endif
()
endfunction
()
# Enable address sanitizer (gcc/clang only)
function
(
spdlog_enable_sanitizer target_name
)
if
(
NOT CMAKE_CXX_COMPILER_ID MATCHES
"GNU|Clang"
)
if
(
NOT CMAKE_CXX_COMPILER_ID MATCHES
"GNU|Clang"
)
message
(
FATAL_ERROR
"Sanitizer supported only for gcc/clang"
)
endif
()
endif
()
message
(
STATUS
"Address sanitizer enabled"
)
target_compile_options
(
${
target_name
}
PRIVATE -fsanitize=address,undefined
)
target_compile_options
(
${
target_name
}
PRIVATE -fno-sanitize=signed-integer-overflow
)
...
...
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