请注意,我是CMake的新手。
如何将几个静态库(.lib)链接到最初在Visual Studio 2019中创建的我的静态库项目?我使用过target_link+libraries
和target_link_directories
,但在静态库项目上却无法使用,但在其他项目上却无法使用。
这是我的剧本
target_link_libraries(${PROJECT_NAME} PUBLIC
"SDL2;"
"SDL2_image;"
"SDL2_mixer;"
"SDL2_ttf;"
"zlibstat;"
"Lua;"
"box2d"
)
target_link_directories(${PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/SDL2/lib/${CMAKE_VS_PLATFORM_NAME}/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/SDL2_image/lib/${CMAKE_VS_PLATFORM_NAME}/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/SDL2_mixer/lib/${CMAKE_VS_PLATFORM_NAME}/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/SDL2_ttf/lib/${CMAKE_VS_PLATFORM_NAME}/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/zlib/lib/${CMAKE_VS_PLATFORM_NAME}_$<CONFIG>/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/Lua/lib/${CMAKE_VS_PLATFORM_NAME}_$<CONFIG>/
${CMAKE_CURRENT_SOURCE_DIR}/Source/Middleware/Box2D/lib/${CMAKE_VS_PLATFORM_NAME}_$<CONFIG>/
)
根据link,它们对静态库项目的属性不起作用。