cmake_minimum_required(VERSION 3.25) project(exeCPP) set(CMAKE_CXX_STANDARD 11) link_directories(lib) include_directories(include) add_executable(exeCPP main.cpp include/library.h) target_link_libraries(exeCPP libstaticLib.a) #cmake_minimum_required(VERSION 3.25) #project(exeCPP) # 指定lib目录 #link_directories(${PROJECT_SOURCE_DIR}/lib) # 指定头文件搜索路径 #add_executable(${PROJECT_NAME} main.cpp) # 将库链接到项目中 #target_link_libraries(${PROJECT_NAME} libstaticLib.a)