From 4406cc4aa1d0480ed8a944122f615d89da6ec302 Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Mon, 2 Sep 2019 14:47:30 +0000 Subject: [PATCH] Move header files to an include directory --- CMakeLists.txt | 9 +++------ cmake/DetectCPPZMQVersion.cmake | 2 +- zmq.hpp => include/zmq.hpp | 0 zmq_addon.hpp => include/zmq_addon.hpp | 0 version.sh | 8 ++++---- 5 files changed, 8 insertions(+), 11 deletions(-) rename zmq.hpp => include/zmq.hpp (100%) rename zmq_addon.hpp => include/zmq_addon.hpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0be6a812..f1f2e069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,14 +38,11 @@ endif (ENABLE_DRAFTS) message(STATUS "cppzmq v${cppzmq_VERSION}") -set(CPPZMQ_HEADERS - zmq.hpp - zmq_addon.hpp -) +set(CPPZMQ_INCLUDE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/") foreach (target cppzmq cppzmq-static) add_library(${target} INTERFACE) - target_include_directories(${target} INTERFACE $ + target_include_directories(${target} INTERFACE $ $) endforeach() @@ -58,7 +55,7 @@ include(CMakePackageConfigHelpers) install(TARGETS cppzmq cppzmq-static EXPORT ${PROJECT_NAME}-targets) -install(FILES ${CPPZMQ_HEADERS} +install(DIRECTORY ${CPPZMQ_INCLUDE_BUILD_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) # GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share". diff --git a/cmake/DetectCPPZMQVersion.cmake b/cmake/DetectCPPZMQVersion.cmake index 99ed9bf5..48b577c7 100644 --- a/cmake/DetectCPPZMQVersion.cmake +++ b/cmake/DetectCPPZMQVersion.cmake @@ -1,5 +1,5 @@ -file(READ "${CMAKE_CURRENT_SOURCE_DIR}/zmq.hpp" _CPPZMQ_H_CONTENTS) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/include/zmq.hpp" _CPPZMQ_H_CONTENTS) string(REGEX REPLACE ".*#define CPPZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_MAJOR "${_CPPZMQ_H_CONTENTS}") string(REGEX REPLACE ".*#define CPPZMQ_VERSION_MINOR ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_MINOR "${_CPPZMQ_H_CONTENTS}") string(REGEX REPLACE ".*#define CPPZMQ_VERSION_PATCH ([0-9]+).*" "\\1" DETECTED_CPPZMQ_VERSION_PATCH "${_CPPZMQ_H_CONTENTS}") diff --git a/zmq.hpp b/include/zmq.hpp similarity index 100% rename from zmq.hpp rename to include/zmq.hpp diff --git a/zmq_addon.hpp b/include/zmq_addon.hpp similarity index 100% rename from zmq_addon.hpp rename to include/zmq_addon.hpp diff --git a/version.sh b/version.sh index f7d9eb66..8c45d46c 100755 --- a/version.sh +++ b/version.sh @@ -3,13 +3,13 @@ # This script extracts the 0MQ version from zmq.hpp, which is the master # location for this information. # -if [ ! -f zmq.hpp ]; then +if [ ! -f include/zmq.hpp ]; then echo "version.sh: error: zmq.hpp does not exist" 1>&2 exit 1 fi -MAJOR=$(grep '^#define CPPZMQ_VERSION_MAJOR \+[0-9]\+' zmq.hpp) -MINOR=$(grep '^#define CPPZMQ_VERSION_MINOR \+[0-9]\+' zmq.hpp) -PATCH=$(grep '^#define CPPZMQ_VERSION_PATCH \+[0-9]\+' zmq.hpp) +MAJOR=$(grep '^#define CPPZMQ_VERSION_MAJOR \+[0-9]\+' include/zmq.hpp) +MINOR=$(grep '^#define CPPZMQ_VERSION_MINOR \+[0-9]\+' include/zmq.hpp) +PATCH=$(grep '^#define CPPZMQ_VERSION_PATCH \+[0-9]\+' include/zmq.hpp) if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then echo "version.sh: error: could not extract version from zmq.hpp" 1>&2 exit 1