mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 01:10:26 +08:00
Clean up CMake a bit more
This commit is contained in:
parent
24e4f0aa87
commit
dd2f293f33
@ -54,8 +54,6 @@ option(SPDLOG_BUILD_TESTS "Build tests" ON)
|
|||||||
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF)
|
option(SPDLOG_FMT_EXTERNAL "Use external fmt library instead of bundled" OFF)
|
||||||
option(SPDLOG_INSTALL "Generate the install target." ${SPDLOG_MASTER_PROJECT})
|
option(SPDLOG_INSTALL "Generate the install target." ${SPDLOG_MASTER_PROJECT})
|
||||||
|
|
||||||
set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog")
|
|
||||||
|
|
||||||
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
@ -63,9 +61,10 @@ find_package(Threads REQUIRED)
|
|||||||
# Build library
|
# Build library
|
||||||
add_library(spdlog src/spdlog.cpp)
|
add_library(spdlog src/spdlog.cpp)
|
||||||
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB )
|
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB )
|
||||||
target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
|
target_include_directories(spdlog PUBLIC
|
||||||
set_target_properties(spdlog PROPERTIES OUTPUT_NAME "spdlog")
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
||||||
set_target_properties(spdlog PROPERTIES DEBUG_POSTFIX "-debug")
|
"$<INSTALL_INTERFACE:include>"
|
||||||
|
)
|
||||||
target_link_libraries(spdlog PUBLIC Threads::Threads)
|
target_link_libraries(spdlog PUBLIC Threads::Threads)
|
||||||
|
|
||||||
# Header only
|
# Header only
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
project(spdlog-utests CXX)
|
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
|
||||||
|
|
||||||
set(SPDLOG_UTESTS_SOURCES
|
set(SPDLOG_UTESTS_SOURCES
|
||||||
test_errors.cpp
|
test_errors.cpp
|
||||||
test_file_helper.cpp
|
test_file_helper.cpp
|
||||||
@ -19,10 +15,10 @@ set(SPDLOG_UTESTS_SOURCES
|
|||||||
test_sink.h
|
test_sink.h
|
||||||
test_fmt_helper.cpp)
|
test_fmt_helper.cpp)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
add_executable(spdlog-utests ${SPDLOG_UTESTS_SOURCES})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
|
target_link_libraries(spdlog-utests spdlog)
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/logs")
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
add_test(NAME spdlog-utests COMMAND spdlog-utests)
|
||||||
|
Loading…
Reference in New Issue
Block a user