Update CMakeLists.txt

This commit is contained in:
Gabi Melman 2019-05-19 17:06:22 +03:00 committed by GitHub
parent 2cd53c6ff1
commit a532a072ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,6 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif()
#---------------------------------------------------------------------------------------
# compiler config
#---------------------------------------------------------------------------------------
@ -29,13 +27,10 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCH
add_compile_options("-Wfatal-errors")
endif()
#---------------------------------------------------------------------------------------
# spdlog target
#---------------------------------------------------------------------------------------
# Check if spdlog is being used directly or via add_subdirectory, but allow overriding
if (NOT DEFINED SPDLOG_MASTER_PROJECT)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
@ -55,7 +50,7 @@ message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
find_package(Threads REQUIRED)
# Build library
# Static library version
add_library(spdlog src/spdlog.cpp)
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)
target_include_directories(spdlog PUBLIC
@ -65,12 +60,11 @@ target_include_directories(spdlog PUBLIC
target_link_libraries(spdlog PUBLIC Threads::Threads)
# Header only
# Header only version
add_library(spdlog_header_only INTERFACE)
target_include_directories(spdlog_header_only INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
target_link_libraries(spdlog_header_only INTERFACE Threads::Threads)
#---------------------------------------------------------------------------------------
# address sanitizers check
#---------------------------------------------------------------------------------------
@ -151,7 +145,5 @@ if (SPDLOG_INSTALL)
#---------------------------------------------------------------------------------------
option(CMAKE_EXPORT_NO_PACKAGE_REGISTRY "Disable registration of CMake's build directory." ON)
export(PACKAGE ${PROJECT_NAME})
endif ()