目前,当我使用 CMake 构建我的 windows 项目(动态库)时,我的.dll
文件进入./output/bin
,我的.h
文件进入./output/include
,但我的.lib
文件只进入./lib
.
我可以做些什么来让我的.lib
文件转到./output/lib
吗?我没有做 CMake 脚本,它很大,所以我不太确定去哪里看。这里有一些我认为可能会有所帮助的片段。
macro(artifacts)
install(TARGETS ${CMAKE_PROJECT_NAME}
RUNTIME DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/output/bin"
LIBRARY DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/output/lib"
)
foreach(header_file ${includes})
string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/(include|src)/" "" header_path_buffer ${header_file})
string(REGEX REPLACE "[^\/]+$" "" header_path ${header_path_buffer})
install(FILES ${header_file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/output/include/${header_path})
endforeach()
endmacro()
string(REGEX REPLACE "^lib-" ${prefix} CMAKE_PROJECT_NAME ${TL_NAME})
project(${CMAKE_PROJECT_NAME})
add_library(${CMAKE_PROJECT_NAME} SHARED ${sources})
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC "include" "${thirdparty_include_dirs}")
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${includes}")
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VERSION ${TL_VERSION})
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES SOVERSION "${TL_VERSION_MAJOR}")
任何建议表示赞赏。