If there is more efficient way please reply.
You should not be manually creating imported static libraries for system libraries! The correct commands are find_library or (better) find_package. In this case, the FindThreads module is what you need.
Also, for installing, prefer to use the GNUInstallDirs module.
cmake_minimum_required(VERSION 3.13)
project(pthread_task)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
add_executable(pthread_task main.c)
target_link_libraries(pthread_task PRIVATE Threads::Threads)
include(GNUInstallDirs)
install(TARGETS pthread_task DESTINATION ${CMAKE_INSTALL_BINDIR})