动态库有传递性,但是通过修饰符修饰public可传递,因为需要用到动态链接库,而且动态链接库只不过是一个文件,只能生成的可执行文件后面,因为只有有了可执行文件才需要链接动态库
CMakeLists.txt
cmake_minimum_required(VERSION 3.15) project(test) # 添加头文件 aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC) include_directories(${PROJECT_SOURCE_DIR}/include) set(CMAKE_CXX_STANDARD 11) # link_directories link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib) add_executable(app ${SRC}) target_link_libraries(app calc)