我的CMakeLists.txt
:
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(INTERNAL, no)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
现在我想添加一个名为doc_internal
的新自定义目标,但这次变量INTERNAL
必须设置为yes
。
这归结为全局不设置变量INTERNAL
,但变量取决于自定义目标。
我怎样才能做到这一点?
答案 0 :(得分:2)
例如configure_file
可以为不同的目标输出不同的Doxyfiles
macro(gen_doxy target INTERNAL)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_${target})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${doxyfile} @ONLY)
add_custom_target(${target} ${DOXYGEN_EXECUTABLE} ${doxyfile} ...)
end macro()