Recently, CMakeLists is often needed to be written in the project. Here is a record of how CMakeLists are written and used in the formal project. The record is hereby for future reference.

project("device-authentication")

cmake_minimum_required(VERSION 3.5)

INCLUDE_DIRECTORIES(.. /include/ .. /.. /src/net/mbedtls/include .. /.. /src/smalgo/sms4/include )SET(my_src_crypto .. /.. /src/net/mbedtls/library/aes.c .. /.. /src/net/mbedtls/library/aesni.c .. /.. /src/net/mbedtls/library/base64.c .. /.. /src/net/mbedtls/library/rsa.c .. /.. /src/net/mbedtls/library/rsa_internal.c .. /.. /src/net/mbedtls/library/entropy.c .. /.. /src/net/mbedtls/library/entropy_poll.c .. /.. /src/net/mbedtls/library/bignum.c .. /.. /src/net/mbedtls/library/sha1.c .. /.. /src/net/mbedtls/library/sha256.c .. /.. /src/net/mbedtls/library/sha512.c .. /.. /src/net/mbedtls/library/md.c .. /.. /src/net/mbedtls/library/md5.c .. /.. /src/net/mbedtls/library/md_wrap.c .. /.. /src/net/mbedtls/library/ripemd160.c .. /.. /src/net/mbedtls/library/platform_util.c .. /.. /src/net/mbedtls/library/oid.c .. /.. /src/net/mbedtls/library/timing.c .. /.. /src/net/mbedtls/library/net_sockets.c .. /.. /src/smalgo/sms4/cbc128.c .. /.. /src/smalgo/sms4/sms4_cbc.c .. /.. /src/smalgo/sms4/sms4_common.c .. /.. /src/smalgo/sms4/sms4_enc.c .. /.. /src/smalgo/sms4/sms4_setkey.c )SET(my_src_crypto_dbg .. /.. /src/net/mbedtls/library/ctr_drbg.c )SET(SRC_LIST_ENCRYPT_BIN
    oem_porting.c
    sdk_porting.c
    authref.c
    test.c
    ${my_src_crypto}
    ${my_src_crypto_dbg}
    )

SET(SRC_LIST_DECRYPT_LIB 
    oem_porting.c
    sdk_porting.c
    authref.c
    auth.c
    ${my_src_crypto}
    ${my_src_crypto_dbg}
    )

SET(SRC_LIST_PRODUCT_LIB
    auth_product.h
    auth_product.c
    )

SET(SRC_LIST_PRODUCT_AUTH_BIN
    auth_product.h
    test_product.c
    )

IF(ENV STREQUAL LINUX)
    LINK_DIRECTORIES(.. /device/cmake-build-debug)ENDIF(a)IF(ENV STREQUAL ANDROID_V8)
    LINK_DIRECTORIES(./v8)
ENDIF(a)IF(ENV STREQUAL ANDROID_V7)
    LINK_DIRECTORIES(./v7)
ENDIF(a)IF(NO_LOCAL_KEY STREQUAL ON)
    ADD_DEFINITIONS(-DNO_LOCAL_KEY)
ENDIF(a)IF(RANDOM_DEVICE_ID STREQUAL ON)
    ADD_DEFINITIONS(-DNO_LOCAL_KEY)
    ADD_DEFINITIONS(-DRANDOM_DEVICE_ID)
ENDIF(a)ADD_DEFINITIONS(-fPIC)
#ADD_LIBRARY(authoal STATIC ${SRC_LIST_DECRYPT_LIB})
#ADD_LIBRARY(authoal SHARED ${SRC_LIST_DECRYPT_LIB})
ADD_EXECUTABLE(eaidkAuth ${SRC_LIST_ENCRYPT_BIN})
#ADD_LIBRARY(productoal SHARED ${SRC_LIST_PRODUCT_LIB})
#TARGET_LINK_LIBRARIES(productoal -lauthoal)
#ADD_LIBRARY(productoal SHARED ${SRC_LIST_PRODUCT_LIB})
#ADD_EXECUTABLE(productAuth ${SRC_LIST_PRODUCT_AUTH_BIN})
#TARGET_LINK_LIBRARIES(productAuth -lauthoal)
Copy the code

To this CMakeLists in the actual project preparation example introduction is completed.