mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-06 04:55:50 +01:00

When using a MSBuild-based CMake generator like 'Visual Studio 15 2017 Win64', the doc build was failing with the error 'MSB6001: Invalid command line switch for "cmd.exe". Illegal characters in path.' This was due to the dependency on Doxyfile*, which wasn't expanded by CMake. The fix is to expand this glob in CMake before specifying the custom command's dependencies. Partial fix for https://github.com/miloyip/rapidjson/issues/622
28 lines
1.0 KiB
CMake
28 lines
1.0 KiB
CMake
find_package(Doxygen)
|
|
|
|
IF(NOT DOXYGEN_FOUND)
|
|
MESSAGE(STATUS "No Doxygen found. Documentation won't be built")
|
|
ELSE()
|
|
file(GLOB SOURCES ${CMAKE_CURRENT_LIST_DIR}/../include/*)
|
|
file(GLOB MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../doc/*.md)
|
|
list(APPEND MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../readme.md)
|
|
|
|
CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
|
|
CONFIGURE_FILE(Doxyfile.zh-cn.in Doxyfile.zh-cn @ONLY)
|
|
|
|
file(GLOB DOXYFILES ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*)
|
|
|
|
add_custom_command(OUTPUT html
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
|
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.zh-cn
|
|
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html
|
|
DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${DOXYFILES}
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../
|
|
)
|
|
|
|
add_custom_target(doc ALL DEPENDS html)
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
|
|
DESTINATION ${DOC_INSTALL_DIR}
|
|
COMPONENT doc)
|
|
ENDIF()
|