overte-AleziaKurdis/tools/jsdoc/CMakeLists.txt
Dale Glass c95de72174 Fix copying jsdoc to interface
Take the jsdoc from tools/jsdoc and copy it to interface.

A subtle issue was found: It turns out that for cmake it matters
what gets parsed first, especially if you rely on setting a variable
in one project and reading it in another.

This can result in things like builds that fail the first time, then
work after re-running cmake.

Generation of jsdoc and screenshare were moved above interface,
because they're a dependency of it.
2021-07-11 19:26:51 +02:00

21 lines
809 B
CMake

set(TARGET_NAME jsdoc)
add_custom_target(${TARGET_NAME})
find_npm()
set(JSDOC_WORKING_DIR ${CMAKE_SOURCE_DIR}/tools/jsdoc)
set(JSDOC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/node_modules/.bin/jsdoc JSDOC_PATH)
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/config.json JSDOC_CONFIG_PATH)
file(TO_NATIVE_PATH ${JSDOC_OUTPUT_DIR}/out OUTPUT_DIR)
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/root.js NATIVE_JSDOC_WORKING_DIR)
set(JSDOC_OUTPUT_PATH ${OUTPUT_DIR} CACHE INTERNAL "${PROJECT_NAME}: JSDoc output directory")
add_custom_command(TARGET ${TARGET_NAME}
COMMAND ${NPM_EXECUTABLE} --no-progress install && ${JSDOC_PATH} ${NATIVE_JSDOC_WORKING_DIR} -c ${JSDOC_CONFIG_PATH} -d ${OUTPUT_DIR}
WORKING_DIRECTORY ${JSDOC_WORKING_DIR}
COMMENT "generate the JSDoc JSON"
)