Skip to content

Commit 178a910

Browse files
authored
Merge pull request #107 from JohanMabille/cmake
Cmake files
2 parents 3cdcff1 + 15936cd commit 178a910

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Vim tmp files
2+
*.swp
3+
4+
# Build directory
5+
build/

CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 2.8.12)
2+
project(cppzmq)
3+
4+
find_package(ZeroMQ REQUIRED)
5+
6+
set (${PROJECT_NAME}_VERSION ${ZeroMQ_VERSION})
7+
message(STATUS "cppzmq v${${PROJECT_NAME}_VERSION}")
8+
9+
set(CPPZMQ_HEADERS
10+
zmq.hpp
11+
zmq_addon.hpp
12+
)
13+
14+
include(GNUInstallDirs)
15+
include(CMakePackageConfigHelpers)
16+
17+
install(FILES ${CPPZMQ_HEADERS}
18+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
19+
20+
# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
21+
set(CPPZMQ_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for cppzmqConfig.cmake")
22+
23+
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
24+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
25+
INSTALL_DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})
26+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
27+
VERSION ${${PROJECT_NAME}_VERSION}
28+
COMPATIBILITY AnyNewerVersion)
29+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
30+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
31+
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})

cppzmqConfig.cmake.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# cppzmq cmake module
2+
# This module sets the following variables in your project::
3+
#
4+
# cppzmq_FOUND - true if cppzmq found on the system
5+
# cppzmq_INCLUDE_DIR - the directory containing cppzmq headers
6+
# cppzmq_LIBRARY - the ZeroMQ library for dynamic linking
7+
# cppzmq_STATIC_LIBRARY - the ZeroMQ library for static linking
8+
9+
@PACKAGE_INIT@
10+
11+
set(PN cppzmq)
12+
set_and_check(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@")
13+
set_and_check(${PN}_LIBRARY "@ZeroMQ_LIBRARY@")
14+
set_and_check(${PN}_STATIC_LIBRARY "@ZeroMQ_STATIC_LIBRARY@")
15+
check_required_components(${PN})

0 commit comments

Comments
 (0)