如何在C++源代码中读取CMake变量 | 那些遇到过的问题
C++程序中读取CmakeList中定义的变量_c++读取cmake配置_土豆西瓜大芝麻的博客-CSDN博客
add_definitions(-D${PROJECT_NAME}_VERSION="${CMAKE_PROJECT_VERSION}")
add_definitions(-D${PROJECT_NAME}_VERSION_DESCRIPTION="${CMAKE_PROJECT_DESCRIPTION}")
string(TIMESTAMP COMPILE_TIME %Y%m%d_%H%M%S)
add_definitions(-D${PROJECT_NAME}_COMPLIE_TIME="${COMPILE_TIME}")