mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +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_INSTALL "Generate the install target." ${SPDLOG_MASTER_PROJECT})
|
||||
|
||||
set(HEADER_BASE "${CMAKE_CURRENT_SOURCE_DIR}/include/spdlog")
|
||||
|
||||
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
@ -63,9 +61,10 @@ find_package(Threads REQUIRED)
|
||||
# Build library
|
||||
add_library(spdlog src/spdlog.cpp)
|
||||
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB )
|
||||
target_include_directories(spdlog PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>")
|
||||
set_target_properties(spdlog PROPERTIES OUTPUT_NAME "spdlog")
|
||||
set_target_properties(spdlog PROPERTIES DEBUG_POSTFIX "-debug")
|
||||
target_include_directories(spdlog PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:include>"
|
||||
)
|
||||
target_link_libraries(spdlog PUBLIC Threads::Threads)
|
||||
|
||||
# Header only
|
||||
|
@ -1,7 +1,3 @@
|
||||
project(spdlog-utests CXX)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(SPDLOG_UTESTS_SOURCES
|
||||
test_errors.cpp
|
||||
test_file_helper.cpp
|
||||
@ -19,10 +15,10 @@ set(SPDLOG_UTESTS_SOURCES
|
||||
test_sink.h
|
||||
test_fmt_helper.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SPDLOG_UTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog)
|
||||
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 ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||
add_test(NAME spdlog-utests COMMAND spdlog-utests)
|
||||
|
Loading…
Reference in New Issue
Block a user