65 lines · plain
1include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)2 3add_clang_tool(clang-doc4 ClangDocMain.cpp5 )6 7clang_target_link_libraries(clang-doc8 PRIVATE9 clangAST10 clangASTMatchers11 clangBasic12 clangDocSupport13 clangFrontend14 clangTooling15 clangToolingCore16 )17target_link_libraries(clang-doc18 PRIVATE19 clangDoc20 )21 22 23set(assets24 index.js25 mustache-index.js26 clang-doc-default-stylesheet.css27 clang-doc-mustache.css28 class-template.mustache29 comment-template.mustache30 enum-template.mustache31 function-template.mustache32 namespace-template.mustache33 template.mustache34)35 36set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets")37set(resource_dir "${LLVM_RUNTIME_OUTPUT_INTDIR}/../share/clang-doc")38set(out_files)39 40function(copy_files_to_dst src_dir dst_dir file)41 set(src "${src_dir}/${file}")42 set(dst "${dst_dir}/${file}")43 add_custom_command(OUTPUT ${dst}44 DEPENDS ${src}45 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}46 COMMENT "Copying ${file} to ${dst_dir}"47 )48 list(APPEND out_files ${dst})49 set(out_files ${out_files} PARENT_SCOPE)50endfunction(copy_files_to_dst)51 52foreach(f ${assets})53 install(FILES ${asset_dir}/${f}54 DESTINATION "${CMAKE_INSTALL_DATADIR}/clang-doc"55 COMPONENT clang-doc)56 copy_files_to_dst(${asset_dir} ${resource_dir} ${f})57endforeach(f)58 59add_custom_target(copy-clang-doc-assets60 DEPENDS ${out_files}61 COMMENT "Copying Clang-Doc Assets"62)63set_target_properties(copy-clang-doc-assets PROPERTIES FOLDER "Clang-Doc/Assets")64add_dependencies(clang-doc copy-clang-doc-assets)65