CMakeLists.txt 1.14 KB
Newer Older
1 2
include_directories(include source)

3
file(GLOB api_src_list include/*.h source/*.cpp source/*.h source/*.c)
4 5 6

set(ENABLE_API_STATIC false)

7 8 9 10
if (IOS)
    add_library(mk_api STATIC ${api_src_list})
    target_link_libraries(mk_api ${LINK_LIB_LIST})
else ()
11 12 13 14 15 16 17 18 19 20 21
    if(ENABLE_API_STATIC)
        add_library(mk_api STATIC ${api_src_list})
        if (WIN32)
            add_definitions(-DMediaKitApi_STATIC)
        endif ()
    else ()
        add_library(mk_api SHARED ${api_src_list})
        if (WIN32)
            add_definitions(-DMediaKitApi_EXPORTS)
        endif ()
    endif()
22 23
    target_link_libraries(mk_api ${LINK_LIB_LIST})
    add_subdirectory(tests)
24

25 26 27 28 29 30 31 32
    #安装目录
    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 ()
33

34 35 36 37
    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})
endif ()