option(Afunction_ON "Build library with A function" ON)
if(Afunction_ON)
add_definitions(-DAfunction_ON)
endif()
set(Complier_files
${path}/src/XXX.cpp)
if (Afunction_ON)
list(APPEND iu456_datapath_processor_SOURCES
${CMAKE_SOURCE_DIR}/A_func.h
${CMAKE_SOURCE_DIR}/A_func.cpp
endif()
其中定义的Afunction_ON,可以在code里面添加宏控制编译的内容
#ifdef(Afunction_ON)
#endif