Skip to content

Commit

Permalink
Problem: examples/chat is not built
Browse files Browse the repository at this point in the history
Solution: fix autoconf and CMake with local project-specific targets
to build it again
  • Loading branch information
bluca committed Jan 2, 2017
1 parent ad700b3 commit 1aa80a8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ install(TARGETS zyre
RUNTIME DESTINATION bin # .dll file
)

include(${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists-local.txt) # Optional project-local hook

########################################################################
# pkgconfig
########################################################################
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if ENABLE_DIST_CMAKEFILES
EXTRA_DIST += \
Findlibzmq.cmake \
Findczmq.cmake \
src/CMakeLists-local.txt \
CMakeLists.txt
endif

Expand All @@ -45,6 +46,7 @@ EXTRA_DIST += \
src/zyre_classes.h

include $(srcdir)/src/Makemodule.am
include $(srcdir)/src/Makemodule-local.am # Optional project-local hook

################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
Expand Down
10 changes: 10 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
AC_DEFUN([AX_PROJECT_LOCAL_HOOK], [
# Check for examples/chat intent
AC_ARG_ENABLE([examples_chat],
AS_HELP_STRING([--enable-examples-chat],
[Compile 'chat' in examples/chat [default=no]]),
[enable_examples_chat=$enableval],
[enable_examples_chat=no])
AM_CONDITIONAL([ENABLE_EXAMPLES_CHAT], [test x$enable_examples_chat != xno])
AM_COND_IF([ENABLE_EXAMPLES_CHAT], [AC_MSG_NOTICE([ENABLE_EXAMPLES_CHAT defined])])
])
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ AC_PROG_SED
AC_PROG_AWK
PKG_PROG_PKG_CONFIG

# Optional project-local hook (acinclude.m4, add AC_DEFUN([AX_PROJECT_LOCAL_HOOK], [whatever]) )
AX_PROJECT_LOCAL_HOOK

# Code coverage
AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
[With GCC Code Coverage reporting])],
Expand Down
13 changes: 0 additions & 13 deletions examples/chat/Makefile.am

This file was deleted.

15 changes: 15 additions & 0 deletions src/CMakeLists-local.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add_executable(
chat
"${SOURCE_DIR}/examples/chat/chat.c"
)
target_link_libraries(
chat
zyre
${LIBZMQ_LIBRARIES}
${CZMQ_LIBRARIES}
${OPTIONAL_LIBRARIES}
)
set_target_properties(
chat
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SOURCE_DIR}/examples/chat"
)
10 changes: 10 additions & 0 deletions src/Makemodule-local.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Project-local changes to auto-generated content

if ENABLE_EXAMPLES_CHAT
EXTRA_DIST += examples/LICENSE

noinst_PROGRAMS += examples/chat/chat
examples_chat_chat_SOURCES = examples/chat/chat.c
examples_chat_chat_CPPFLAGS = ${AM_CPPFLAGS}
examples_chat_chat_LDADD = ${program_libs}
endif #ENABLE_EXAMPLES_CHAT

0 comments on commit 1aa80a8

Please sign in to comment.