summaryrefslogtreecommitdiffstats
path: root/conf/unit/CMakeLists.txt
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-05-15 20:49:14 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2019-06-04 09:52:31 +0200
commit5b801a3e7b0465f88b785a155dd430ba09c56568 (patch)
tree82e06c5e13c7a4652170e17665f74496539a7022 /conf/unit/CMakeLists.txt
parenta5cf62686366f4a69becf62aa4d953e034c9bee4 (diff)
afm-unit.conf: Refactor its generation
The process of generating the file /etc/afm-unit.conf had be reworked to be more straight forward. Before that commit, a manual operation (a "make") had to be done before committing the repository. This was not efficient, error prone and kept temporary files in conf. That commit changes it by calling m4 through cmake. Bug-AGL: SPEC-2436 Change-Id: Ia32a810286471dde8a01387d157e33277d67411d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'conf/unit/CMakeLists.txt')
-rw-r--r--conf/unit/CMakeLists.txt25
1 files changed, 21 insertions, 4 deletions
diff --git a/conf/unit/CMakeLists.txt b/conf/unit/CMakeLists.txt
index 1d11e11..7fbe6e1 100644
--- a/conf/unit/CMakeLists.txt
+++ b/conf/unit/CMakeLists.txt
@@ -18,15 +18,32 @@
cmake_minimum_required(VERSION 2.8)
+find_program(M4EXEC m4)
+mark_as_advanced(M4EXEC)
+
+file(GLOB in_afm_unit_list
+ LIST_DIRECTORIES false
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ CONFIGURE_DEPENDS
+ afm-unit *.inc
+)
+foreach(f IN LISTS in_afm_unit_list)
+ configure_file(${f} ${f})
+ set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/afm-unit.conf APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${f})
+endforeach(f)
if(AGL_DEVEL)
- configure_file(afm-unit-debug.conf.in afm-unit.conf)
-else()
- configure_file(afm-unit.conf.in afm-unit.conf)
+ set(optm4 -DAGL_DEVEL)
endif()
+add_custom_command(
+ OUTPUT afm-unit.conf
+ COMMAND ${M4EXEC} ${optm4} -I. afm-unit > afm-unit.conf
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
+add_custom_target(unitconf ALL DEPENDS afm-unit.conf)
if(NOT USE_SDK)
install(DIRECTORY DESTINATION ${afm_confdir}/unit.env.d)
install(DIRECTORY DESTINATION ${afm_confdir}/widget.env.d)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-unit.conf DESTINATION ${afm_confdir})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-unit.conf DESTINATION ${afm_confdir})
endif()