Android添加第三方库

if(ANDROID)
    # the follow VARIABLE must be written before find_package or it will be no effective.
    # must add CACHE INTERNAL parameter. or it will failed.
    message("add the third so library to project")
    #set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android" CACHE INTERNAL "")
    set(ANDROID_EXTRA_LIBS "${LIBSSH_SOURCE_PATH}/lib/libssh.so" CACHE INTERNAL "")
    message("ANDROID_EXTRA_LIBS=${ANDROID_EXTRA_LIBS}")
endif()

The CACHE is mandatory, otherwise QtCreator won’t see the variable and it won’t use it