|
|
|
@ -1,6 +1,11 @@
|
|
|
|
|
# Get spdlog version from include/spdlog/version.h and put it in SPDLOG_VERSION
|
|
|
|
|
function(spdlog_extract_version)
|
|
|
|
|
file(READ "${CMAKE_CURRENT_LIST_DIR}/include/spdlog/version.h" file_contents)
|
|
|
|
|
if(CMAKE_PROJECT_NAME STREQUAL "spdlog_examples")
|
|
|
|
|
message(STATUS "project(spdlog_examples) ...")
|
|
|
|
|
file(READ "${CMAKE_SOURCE_DIR}/../include/spdlog/version.h" file_contents)
|
|
|
|
|
else()
|
|
|
|
|
file(READ "${CMAKE_CURRENT_LIST_DIR}/include/spdlog/version.h" file_contents)
|
|
|
|
|
endif()
|
|
|
|
|
string(REGEX MATCH "SPDLOG_VER_MAJOR ([0-9]+)" _ "${file_contents}")
|
|
|
|
|
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
|
|
|
|
|
message(FATAL_ERROR "Could not extract major version number from spdlog/version.h")
|
|
|
|
@ -20,7 +25,7 @@ function(spdlog_extract_version)
|
|
|
|
|
set(ver_patch ${CMAKE_MATCH_1})
|
|
|
|
|
|
|
|
|
|
set(SPDLOG_VERSION_MAJOR ${ver_major} PARENT_SCOPE)
|
|
|
|
|
set (SPDLOG_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE)
|
|
|
|
|
set(SPDLOG_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE)
|
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +33,7 @@ endfunction()
|
|
|
|
|
function(spdlog_enable_warnings target_name)
|
|
|
|
|
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>
|
|
|
|
|
-Wall -Wextra -Wconversion -Wpedantic -Wfatal-errors>
|
|
|
|
|
$<$<CXX_COMPILER_ID:MSVC>:/W4>)
|
|
|
|
|
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
|
|
|
|
|
target_compile_options(${target_name} PRIVATE /WX)
|
|
|
|
@ -38,7 +43,7 @@ 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()
|
|
|
|
|
message(STATUS "Address sanitizer enabled")
|
|
|
|
|