官方文档:https://cmake.org/cmake/help/latest/index.html
#全局搜索.h和.cpp文件放入LOGWIN变量中
FILE(GLOB LOGWIN "log/logan-win/*.h" "log/logan-win/*.cpp")
FILE(GLOB CLOGAN "log/logan-win/Clogan/*.h" "log/logan-win/Clogan/*.c")
FILE(GLOB MBEDTLS_INCLUDE "log/logan-win/mbedtls/include/mbedtls/*.h" )
FILE(GLOB MBEDTLS_LIB "log/logan-win/mbedtls/library/*.h" "log/logan-win/mbedtls/library/*.c")
- source_group 用于整理工程中的文件,将头文件源文件那目录结构进行分组
source_group(log/logan-win FILES ${LOGWIN})
source_group(log/logan-win/Clogan FILES ${CLOGAN})
source_group(log/logan-win/mbedtls/include FILES ${MBEDTLS_INCLUDE})
source_group(log/logan-win/mbedtls/library FILES ${MBEDTLS_LIB})
#生成动态库文件
add_library(${PROJECT_NAME} SHARED ${JRTC_DLL_SRC} ${LOGAN_ALL})
|