project(名称)add_library(${PROJECT_NAME}
xxx.cc
)add_library(名称::lib ALIAS ${PROJECT_NAME})//取别名//头文件target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
src文件夹CMakeist.txt
project(名称)add_library(${PROJECT_NAME}
xxx.cc
)add_library(名称::lib ALIAS ${PROJECT_NAME})target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})//静态连接库target_link_libraries(${PROJECT_NAME}
名称::lib)