cmake_minimum_required(VERSION 3.5.1) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) # set(CMAKE_BUILD_TYPE "Debug") option(SPARK_DEBUG_MESSAGE "CMake Spark Module Debug Message." OFF) set(SPARK_DEBUG_LOGFILE "${CMAKE_BINARY_DIR}/spark_debug.log" CACHE STRING "Spark Build Debug logfile." FORCE) file(WRITE ${SPARK_DEBUG_LOGFILE}) macro(spark_debug_message) if(SPARK_DEBUG_MESSAGE) set(SPARK_ONECE_LOG ${ARGN}) if(NOT "${SPARK_ONECE_LOG}" STREQUAL "") message("[SPARK_MESSAGE]: " ${SPARK_ONECE_LOG}) endif(NOT "${SPARK_ONECE_LOG}" STREQUAL "") file(APPEND ${SPARK_DEBUG_LOGFILE} ${SPARK_ONECE_LOG} "\n") unset(SPARK_ONECE_LOG) endif(SPARK_DEBUG_MESSAGE) endmacro(spark_debug_message) # Windows 的特别标注,生成的目标中区分 Debug(_d) 或 Release(_r) if(WIN32) set(CMAKE_DEBUG_POSTFIX "_d") set(CMAKE_RELEASE_POSTFIX "_r") endif(WIN32)