Skip to content

Commit 099bcfc

Browse files
committed
Problem: cppzmq build broken with C++11 compiler and git cloned repo.
Default build, ./ci_build.sh without any arguments, which causes to run with draft disabled, does not work properly for git cloned repository and C++11 compiler. Two issues: 1. For git cloned repository ENABLE_DRAFTS is ON by default but libzmq compiled build without drafts .Travis did not catch that because default build runs on non C++11 compiler. 2. testutil.hpp does not build because of missing draft guards. Solution 1: Remove check for presence of .git for enabling draft API as it is confusing to use with ENABLE_DRAFTS flag and there should be only one explicit way to enable draft build. Solution 2: add missing draft guards in testutil.hpp for server/client socket in use there. Solution 3: add extra Travis build covering C++11 compiler and non draft enabled build.
1 parent d487e67 commit 099bcfc

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@ matrix:
3030
# GCC default, draft disabled, default libzmq (defined in ci_build.sh)
3131
- os: linux
3232

33-
# GCC 7, draft enabled (default), latest libzmq (default)
33+
# GCC 6, draft disabled (default), latest libzmq (default)
34+
- os: linux
35+
addons:
36+
apt:
37+
sources:
38+
- ubuntu-toolchain-r-test
39+
packages:
40+
- g++-6
41+
env:
42+
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
43+
44+
# GCC 7, draft enabled, latest libzmq (default)
3445
- os: linux
3546
addons:
3647
apt:

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ if (ZeroMQ_FOUND AND (NOT TARGET libzmq OR NOT TARGET libzmq-static))
1919
message(FATAL_ERROR "ZeroMQ version not supported!")
2020
endif()
2121

22-
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
23-
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
24-
else ()
25-
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
26-
endif ()
22+
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
2723
if (ENABLE_DRAFTS)
2824
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
2925
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")

tests/testutil.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <gtest/gtest.h>
44
#include <zmq.hpp>
55

6-
#if defined(ZMQ_CPP11)
6+
#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11)
77
#include <array>
88

99
class loopback_ip4_binder

0 commit comments

Comments
 (0)