aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/common.cmake
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-29 02:01:40 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-29 02:01:40 +0200
commit71ad3c3141c8e5b0fd0a9a671c2230448ff80e26 (patch)
tree009ed8538977d5667cc3ba5ff3a8c276ac49af99 /cmake/common.cmake
parent1b16a2806eb6a22be45468771f7e72700112d1de (diff)
Use FATAL_ERROR if missing file to build packages
Change-Id: I5d1b0abf5447fdf9938d4c4d4b7ad0d921cf27a0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/common.cmake')
-rw-r--r--cmake/common.cmake86
1 files changed, 45 insertions, 41 deletions
diff --git a/cmake/common.cmake b/cmake/common.cmake
index 524e023..28de7b0 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -179,66 +179,70 @@ macro(remote_targets_populate)
endmacro(remote_targets_populate)
macro(wgt_package_build)
- if(NOT EXISTS ${TEMPLATE_WGT_DIR}/config.xml.in OR NOT EXISTS ${TEMPLATE_WGT_DIR}/icon-default.png)
- MESSAGE(SEND_ERROR "${Red}WARNING ! Missing mandatory files to build widget file.\nYou need config.xml.in and ${PROJECT_ICON} files in ${TEMPLATE_WGT_DIR} folder.${ColourReset}")
- else()
# Build widget spec file from template only once (Fulup good idea or should depend on time ????)
if(NOT EXISTS ${TEMPLATE_WGT_DIR}/config.xml.in OR NOT EXISTS ${TEMPLATE_WGT_DIR}/${PROJECT_ICON})
configure_file(${TEMPLATE_WGT_DIR}/config.xml.in ${PROJECT_PKG_BUILD_DIR}/config.xml)
configure_file(${TEMPLATE_WGT_DIR}/config.xml.in ${PROJECT_PKG_ENTRY_POINT}/config.xml)
file(COPY ${TEMPLATE_WGT_DIR}/icon-default.png DESTINATION ${PROJECT_PKG_BUILD_DIR}/${PROJECT_ICON})
endif(NOT EXISTS ${TEMPLATE_WGT_DIR}/config.xml.in OR NOT EXISTS ${TEMPLATE_WGT_DIR}/${PROJECT_ICON})
+ if(NOT EXISTS ${WGT_TEMPLATE_DIR}/config.xml.in OR NOT EXISTS ${WGT_TEMPLATE_DIR}/icon-default.png)
+ MESSAGE(FATAL_ERROR "${Red}WARNING ! Missing mandatory files to build widget file.\nYou need config.xml.in and ${PROJECT_ICON} files in ${WGT_TEMPLATE_DIR} folder.${ColourReset}")
+ endif()
- # Fulup ??? copy any extra file in wgt/etc into populate package before building the widget
- file(GLOB PROJECT_CONF_FILES "${TEMPLATE_WGT_DIR}/etc/*")
- if(${PROJECT_CONF_FILES})
- file(COPY "${TEMPLATE_WGT_DIR}/etc/*" DESTINATION ${PROJECT_PKG_BUILD_DIR}/etc/)
- endif(${PROJECT_CONF_FILES})
+ configure_file(${WGT_TEMPLATE_DIR}/config.xml.in ${PROJECT_PKG_BUILD_DIR}/config.xml)
+ configure_file(${WGT_TEMPLATE_DIR}/config.xml.in ${PROJECT_PKG_ENTRY_POINT}/config.xml)
+ file(COPY ${WGT_TEMPLATE_DIR}/icon-default.png DESTINATION ${PROJECT_PKG_BUILD_DIR}/${PROJECT_ICON})
- add_custom_command(OUTPUT ${PROJECT_NAME}.wgt
- DEPENDS ${PROJECT_TARGETS}
- COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${PROJECT_PKG_BUILD_DIR}
- )
+ # Fulup ??? copy any extra file in wgt/etc into populate package before building the widget
+ file(GLOB PROJECT_CONF_FILES "${WGT_TEMPLATE_DIR}/etc/*")
+ if(${PROJECT_CONF_FILES})
+ file(COPY "${WGT_TEMPLATE_DIR}/etc/*" DESTINATION ${PROJECT_PKG_BUILD_DIR}/etc/)
+ endif(${PROJECT_CONF_FILES})
- add_custom_target(widget DEPENDS ${PROJECT_NAME}.wgt)
- add_dependencies(widget populate)
- set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.wgt")
+ add_custom_command(OUTPUT ${PROJECT_NAME}.wgt
+ DEPENDS ${PROJECT_TARGETS}
+ COMMAND wgtpkg-pack -f -o ${PROJECT_NAME}.wgt ${PROJECT_PKG_BUILD_DIR}
+ )
- if(PACKAGE_MESSAGE)
- add_custom_command(TARGET widget
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${PACKAGE_MESSAGE}")
- endif()
+ add_custom_target(widget DEPENDS ${PROJECT_NAME}.wgt)
+ add_dependencies(widget populate)
+ set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.wgt")
+
+ if(PACKAGE_MESSAGE)
+ add_custom_command(TARGET widget
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${PACKAGE_MESSAGE}")
endif()
endmacro(wgt_package_build)
macro(rpm_package_build)
- if(NOT EXISTS ${TEMPLATE_RPM_DIR}/config.spec.in)
- MESSAGE(STATUS "Missing mandatory files: you need config.spec.in in ${TEMPLATE_RPM_DIR} folder.")
- else()
- # extract PROJECT_PKG_DEPS and replace ; by , for RPM spec file
- get_property(PROJECT_PKG_DEPS GLOBAL PROPERTY PROJECT_PKG_DEPS)
- foreach (PKFCONF ${PROJECT_PKG_DEPS})
+ if(NOT EXISTS ${RPM_TEMPLATE_DIR}/rpm-config.spec.in)
+ MESSAGE(FATAL_ERROR "${Red}Missing mandatory files: you need rpm-config.spec.in in ${RPM_TEMPLATE_DIR} folder.${ColourReset}")
+ endif()
+
+ # extract PROJECT_PKG_DEPS and replace ; by , for RPM spec file
+ get_property(PROJECT_PKG_DEPS GLOBAL PROPERTY PROJECT_PKG_DEPS)
+ foreach (PKFCONF ${PROJECT_PKG_DEPS})
set(RPM_PKG_DEPS "${RPM_PKG_DEPS}, pkgconfig(${PKFCONF})")
- endforeach()
+ endforeach()
- # build rpm spec file from template
- configure_file(${TEMPLATE_RPM_DIR}/config.spec.in ${PROJECT_PKG_BUILD_DIR}/config.spec)
+ # build rpm spec file from template
+ configure_file(${RPM_TEMPLATE_DIR}/rpm-config.spec.in ${PROJECT_PKG_BUILD_DIR}/${PROJECT_NAME}.spec)
+ configure_file(${RPM_TEMPLATE_DIR}/rpm-config.spec.in ${PROJECT_PKG_ENTRY_POINT}/${PROJECT_NAME}.spec)
- add_custom_command(OUTPUT ${PROJECT_NAME}.spec
- DEPENDS ${PROJECT_TARGETS}
- COMMAND rpmbuild -ba ${PROJECT_PKG_BUILD_DIR}/config.spec
- )
+ add_custom_command(OUTPUT ${PROJECT_NAME}.spec
+ DEPENDS ${PROJECT_TARGETS}
+ COMMAND rpmbuild -ba ${PROJECT_PKG_BUILD_DIR}/${PROJECT_NAME}.spec
+ )
- add_custom_target(rpm DEPENDS ${PROJECT_NAME}.spec)
- add_dependencies(rpm populate)
- set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.spec")
+ add_custom_target(rpm DEPENDS ${PROJECT_NAME}.spec)
+ add_dependencies(rpm populate)
+ set(ADDITIONAL_MAKE_CLEAN_FILES, "${PROJECT_NAME}.spec")
- if(PACKAGE_MESSAGE)
- add_custom_command(TARGET rpm
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${PACKAGE_MESSAGE}")
- endif()
+ if(PACKAGE_MESSAGE)
+ add_custom_command(TARGET rpm
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "++ ${PACKAGE_MESSAGE}")
endif()
endmacro(rpm_package_build)