${SPDLOG_LIBRARIES} vs spdlog:spdlog


find_library(SPDLOG_LIBRARIES
    NAMES 
        spdlog
        spdlogd
    REQUIRED
)

# SPDLOG_LIBRARIES is  C:\spdlog\lib\spdlogd.lib
# can work
target_link_libraries(test_example PRIVATE spdlog::spdlog)

# can't  work   => no such spdlog/spdlog.h
target_link_libraries(test_example PRIVATE ${SPDLOG_LIBRARIES})

#include "spdlog/spdlog.h"

int main(int, char *[])
{

    spdlog::info("Welcome to spdlog version {}.{}.{}  !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH);

}

Why target_link_libraries(test_example PRIVATE ${SPDLOG_LIBRARIES})
can not work?

From what I see here, you linked directly to the library binaries (${SPDLOG_LIBRARIES}), not to its CMake target, so now you are missing include paths to the library headers. And if you linked to the target instead (if you have a CMake config for it, that is), most likely headers paths would’ve been set too (but that of course depends on how this library’s maintainers composed its config).

That spdlog::spdlog looks like a proper target, but nothing in your code fragment indicates where did it come from.

A1:
I don’t know the spdlog where did it come from too.
I just download the GitHub - gabime/spdlog: Fast C++ logging library. and install it.
And set

find_package(SPDLOG REQUIRED)

and then I can use spdlog::spdlog that I don’t know how to generate it.

target_link_libraries(test_example PRIVATE spdlog::spdlog)

A2:
Are you saying that the two pieces of code are the same?

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( SPDLOG REQUIRED )
include_directories( ${SPDLOG _INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${SPDLOG _LIBS} )
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( SPDLOG REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage spdlog::spdlog )

conclusion

include_directories( ${SPDLOG _INCLUDE_DIRS} )
target_link_libraries( DisplayImage ${SPDLOG _LIBS} )

# they are the same thing

target_link_libraries( DisplayImage spdlog::spdlog )

They are not the same. CMake targets (like spdlog::spdlog) may carry more information, than just the include dirs, and what to link (linking flags, defines,…).
Generally, if a target is available, you should link to it instead of playing with the variables. That’s the modern way.