summaryrefslogtreecommitdiffstats
path: root/cmake/cmake.d/02-macros.cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-08-11 10:16:05 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:47 +0200
commit1f82b41bcef462c057aabf4d918189e15ce319c1 (patch)
tree75ce5176a78be36d8b4a23a9c8b486574ac71e4c /cmake/cmake.d/02-macros.cmake
parentf0fcb00c0d7d1276d272c0fb1ee02e505e8ba0b1 (diff)
Be able to choose openAPI definition file name.
Use a variable OPENAPI_DEF to define the file name else use the default convention ${OUTPUT_NAME}-apidef. Update the docs in consequence. Change-Id: Ibc29d6079d185e47a80dbfe4df5dedd28f7f63c4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d/02-macros.cmake')
-rw-r--r--cmake/cmake.d/02-macros.cmake23
1 files changed, 17 insertions, 6 deletions
diff --git a/cmake/cmake.d/02-macros.cmake b/cmake/cmake.d/02-macros.cmake
index 6ebff21..e116d2e 100644
--- a/cmake/cmake.d/02-macros.cmake
+++ b/cmake/cmake.d/02-macros.cmake
@@ -98,12 +98,23 @@ macro(project_targets_populate)
)
add_custom_target(${POPULE_PACKAGE_TARGET} DEPENDS ${PACKAGE_LIBDIR}/${P}${OUT}.so)
- add_custom_command(OUTPUT ${SD}/${P}${OUT}.h
- DEPENDS ${SD}/${P}${OUT}.json
- COMMAND afb-genskel ${SD}/${P}${OUT}.json > ${SD}/${P}${OUT}.h
- )
- add_custom_target("${TARGET}_GENSKEL" DEPENDS ${SD}/${P}${OUT}.h)
- add_dependencies(${TARGET} "${TARGET}_GENSKEL")
+ if (OPENAPI_DEF)
+ add_custom_command(OUTPUT ${SD}/${OPENAPI_DEF}.h
+ DEPENDS ${SD}/${OPENAPI_DEF}.json
+ COMMAND afb-genskel ${SD}/${OPENAPI_DEF}.json > ${SD}/${OPENAPI_DEF}.h
+ )
+ add_custom_target("${TARGET}_GENSKEL" DEPENDS ${SD}/${OPENAPI_DEF}.h
+ COMMENT "Generating OpenAPI header file ${OPENAPI_DEF}.h")
+ add_dependencies(${TARGET} "${TARGET}_GENSKEL")
+ else()
+ add_custom_command(OUTPUT ${SD}/${OUT}-apidef.h
+ DEPENDS ${SD}/${OUT}-apidef.json
+ COMMAND afb-genskel ${SD}/${OUT}-apidef.json > ${SD}/${OUT}-apidef.h
+ )
+ add_custom_target("${TARGET}_GENSKEL" DEPENDS ${SD}/${OUT}-apidef.h
+ COMMENT "Generating OpenAPI header file ${OUT}-apidef.h")
+ add_dependencies(${TARGET} "${TARGET}_GENSKEL")
+ endif()
elseif(${T} STREQUAL "EXECUTABLE")
add_custom_command(OUTPUT ${PACKAGE_BINDIR}/${P}${OUT}
DEPENDS ${BD}/${P}${OUT}