aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/samples/CMakeLists.txt
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2019-04-11 13:09:56 +0200
committerJose Bollo <jose.bollo@iot.bzh>2019-04-12 10:55:54 +0200
commit6b2b09db8ee3cf88b09b59696d50b4fa2de79a72 (patch)
tree081c5ce2ad13790500dd14078d355796380539cf /bindings/samples/CMakeLists.txt
parent9cf1fcea338281f76eaac000930479b18dacef01 (diff)
Reordering of sample and tutorial bindings
The main idea here is to install the sample and tutorial bindings in specific directory. This will at the end help to package parts of the binder. It also includes a simplification of CMakeLists files. Also fix an error in packaging rpm. Bug-AGL: SPEC-2165 Change-Id: I494cc753796848cde849de1c3596893c78fa228f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'bindings/samples/CMakeLists.txt')
-rw-r--r--bindings/samples/CMakeLists.txt88
1 files changed, 14 insertions, 74 deletions
diff --git a/bindings/samples/CMakeLists.txt b/bindings/samples/CMakeLists.txt
index 34b364f5..51442684 100644
--- a/bindings/samples/CMakeLists.txt
+++ b/bindings/samples/CMakeLists.txt
@@ -16,78 +16,18 @@
# limitations under the License.
###########################################################################
-
-INCLUDE_DIRECTORIES(${include_dirs})
-
-##################################################
-# AuthLogin
-##################################################
-ADD_LIBRARY(authLogin MODULE AuthLogin.c)
-SET_TARGET_PROPERTIES(authLogin PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(authLogin ${link_libraries})
-INSTALL(TARGETS authLogin
- LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# DemoContext
-##################################################
-ADD_LIBRARY(demoContext MODULE DemoContext.c)
-SET_TARGET_PROPERTIES(demoContext PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(demoContext ${link_libraries})
-INSTALL(TARGETS demoContext
- LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# DemoPost
-##################################################
-ADD_LIBRARY(demoPost MODULE DemoPost.c)
-SET_TARGET_PROPERTIES(demoPost PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(demoPost ${link_libraries})
-INSTALL(TARGETS demoPost
- LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# tic-tac-toe
-##################################################
-ADD_LIBRARY(tic-tac-toe MODULE tic-tac-toe.c)
-SET_TARGET_PROPERTIES(tic-tac-toe PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(tic-tac-toe ${link_libraries})
-INSTALL(TARGETS tic-tac-toe
- LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# hello2
-##################################################
-ADD_LIBRARY(hello2 MODULE hello2.c)
-SET_TARGET_PROPERTIES(hello2 PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(hello2 ${link_libraries})
-INSTALL(TARGETS hello2
- LIBRARY DESTINATION ${binding_install_dir})
-
-##################################################
-# hello3
-##################################################
-ADD_LIBRARY(hello3 MODULE hello3.c)
-SET_TARGET_PROPERTIES(hello3 PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-TARGET_LINK_LIBRARIES(hello3 ${link_libraries})
-INSTALL(TARGETS hello3
- LIBRARY DESTINATION ${binding_install_dir})
+macro(sample name source)
+ add_library(${name} MODULE ${source})
+ set_target_properties(${name} PROPERTIES PREFIX "" LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map")
+# target_link_libraries(${name} ${link_libraries})
+ target_link_libraries(${name} ${json-c_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT})
+ install(TARGETS ${name} LIBRARY DESTINATION ${install_datadir}/bindings/samples)
+endmacro(sample)
+
+sample(authLogin AuthLogin.c)
+sample(demoContext DemoContext.c)
+sample(demoPost DemoPost.c)
+sample(tic-tac-toe tic-tac-toe.c)
+sample(hello2 hello2.c)
+sample(hello3 hello3.c)