添加install命令

This commit is contained in:
xiongziliang 2019-12-27 12:03:54 +08:00
parent c3a32e862a
commit 2aec68fd6f
2 changed files with 14 additions and 3 deletions

View File

@ -1,13 +1,24 @@
include_directories(include source) include_directories(include source)
file(GLOB api_src_list include/*.h source/*.cpp source/*.h source/*.c) file(GLOB api_src_list include/*.h source/*.cpp source/*.h source/*.c)
add_library(api SHARED ${api_src_list}) add_library(mk_api SHARED ${api_src_list})
if(WIN32) if(WIN32)
add_definitions(-DMediaKitApi_EXPORTS) add_definitions(-DMediaKitApi_EXPORTS)
endif() endif()
target_link_libraries(api ${LINK_LIB_LIST}) target_link_libraries(mk_api ${LINK_LIB_LIST})
add_subdirectory(tests) add_subdirectory(tests)
#
if(WIN32)
set(INSTALL_PATH_LIB $ENV{HOME}/${CMAKE_PROJECT_NAME}/lib)
set(INSTALL_PATH_INCLUDE $ENV{HOME}/${CMAKE_PROJECT_NAME}/include)
else()
set(INSTALL_PATH_LIB lib)
set(INSTALL_PATH_INCLUDE include)
endif()
file(GLOB api_header_list include/*.h)
install(FILES ${api_header_list} DESTINATION ${INSTALL_PATH_INCLUDE})
install(TARGETS mk_api ARCHIVE DESTINATION ${INSTALL_PATH_LIB} LIBRARY DESTINATION ${INSTALL_PATH_LIB})

View File

@ -9,7 +9,7 @@ foreach(TEST_SRC ${TEST_SRC_LIST})
set_target_properties(${exe_name} PROPERTIES COMPILE_FLAGS ${VS_FALGS} ) set_target_properties(${exe_name} PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
endif(WIN32) endif(WIN32)
target_link_libraries(${exe_name} api) target_link_libraries(${exe_name} mk_api)
endforeach() endforeach()