"Fossies" - the Fresh Open Source Software Archive

Member "nanomsg-1.1.5/CMakeLists.txt" (15 Oct 2018, 18271 Bytes) of package /linux/misc/nanomsg-1.1.5.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 1.1.4_vs_1.1.5.

    1 #
    2 #   Copyright (c) 2012 Martin Sustrik  All rights reserved.
    3 #   Copyright (c) 2013 GoPivotal, Inc.  All rights reserved.
    4 #   Copyright (c) 2015-2016 Jack R. Dunaway. All rights reserved.
    5 #   Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com>
    6 #   Copyright 2017 Garrett D'Amore <garrett@damore.org>
    7 #
    8 #   Permission is hereby granted, free of charge, to any person obtaining a copy
    9 #   of this software and associated documentation files (the "Software"),
   10 #   to deal in the Software without restriction, including without limitation
   11 #   the rights to use, copy, modify, merge, publish, distribute, sublicense,
   12 #   and/or sell copies of the Software, and to permit persons to whom
   13 #   the Software is furnished to do so, subject to the following conditions:
   14 #
   15 #   The above copyright notice and this permission notice shall be included
   16 #   in all copies or substantial portions of the Software.
   17 #
   18 #   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   19 #   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20 #   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   21 #   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   22 #   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   23 #   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   24 #   IN THE SOFTWARE.
   25 #
   26 
   27 cmake_minimum_required (VERSION 2.8.12)
   28 
   29 project (nanomsg C)
   30 include (CheckFunctionExists)
   31 include (CheckSymbolExists)
   32 include (CheckStructHasMember)
   33 include (CheckLibraryExists)
   34 include (CheckCSourceCompiles)
   35 include (GNUInstallDirs)
   36 
   37 if (POLICY CMP0042)
   38     # Newer cmake on MacOS should use @rpath
   39     cmake_policy (SET CMP0042 NEW)
   40 endif ()
   41 
   42 set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
   43 list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
   44 if ("${isSystemDir}" STREQUAL "-1")
   45     set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
   46 endif ("${isSystemDir}" STREQUAL "-1")
   47 
   48 set (NN_DESCRIPTION "High-Performance Scalability Protocols")
   49 set (ISSUE_REPORT_MSG "Please consider opening an issue at https://github.com/nanomsg/nanomsg")
   50 
   51 # Determine library versions.
   52 
   53 file (READ src/nn.h NN_HDR_STR)
   54 string (REGEX REPLACE ".*#define +NN_VERSION_CURRENT +([0-9]+).*" "\\1" NN_VERSION_CURRENT "${NN_HDR_STR}")
   55 string (REGEX REPLACE ".*#define +NN_VERSION_REVISION +([0-9]+).*" "\\1" NN_VERSION_REVISION "${NN_HDR_STR}")
   56 string (REGEX REPLACE ".*#define +NN_VERSION_AGE +([0-9]+).*" "\\1" NN_VERSION_AGE "${NN_HDR_STR}")
   57 
   58 if ((NN_VERSION_CURRENT STREQUAL "") OR (NN_VERSION_REVISION STREQUAL "") OR (NN_VERSION_AGE STREQUAL ""))
   59     message (FATAL_ERROR "Could not read ABI version from nn.h")
   60 else ()
   61     set (NN_ABI_VERSION "${NN_VERSION_CURRENT}")
   62     set (NN_LIB_VERSION "${NN_VERSION_CURRENT}.${NN_VERSION_REVISION}.${NN_VERSION_AGE}")
   63     message (STATUS "Detected nanomsg ABI v${NN_ABI_VERSION} (v${NN_LIB_VERSION})")
   64 endif ()
   65 
   66 # Determine package version.
   67 find_package (Git QUIET)
   68 if (DEFINED ENV{TRAVIS_TAG})
   69     set (NN_PACKAGE_VERSION "$ENV{TRAVIS_TAG}")
   70 elseif (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
   71     # Working off a git repo, using git versioning
   72 
   73     # Get version from last tag
   74     execute_process (
   75         COMMAND             "${GIT_EXECUTABLE}" describe --always# | sed -e "s:v::"
   76         WORKING_DIRECTORY   "${PROJECT_SOURCE_DIR}"
   77         OUTPUT_VARIABLE     NN_PACKAGE_VERSION
   78         OUTPUT_STRIP_TRAILING_WHITESPACE)
   79 
   80     # If the sources have been changed locally, add -dirty to the version.
   81     execute_process (
   82         COMMAND             "${GIT_EXECUTABLE}" diff --quiet
   83         WORKING_DIRECTORY   "${PROJECT_SOURCE_DIR}"
   84         RESULT_VARIABLE     res)
   85     if (res EQUAL 1)
   86         set (NN_PACKAGE_VERSION "${NN_PACKAGE_VERSION}-dirty")
   87     endif()
   88 
   89 elseif (EXISTS ${PROJECT_SOURCE_DIR}/.version)
   90     #  If git is not available (e.g. when building from source package)
   91     #  we can extract the package version from .version file.
   92     file (STRINGS .version NN_PACKAGE_VERSION)
   93 else ()
   94     set (NN_PACKAGE_VERSION "Unknown")
   95 endif()
   96 
   97 # User-defined options.
   98 
   99 option (NN_STATIC_LIB "Build static library instead of shared library." OFF)
  100 option (NN_ENABLE_DOC "Enable building documentation." ON)
  101 option (NN_ENABLE_COVERAGE "Enable coverage reporting." OFF)
  102 option (NN_ENABLE_GETADDRINFO_A "Enable/disable use of getaddrinfo_a in place of getaddrinfo." ON)
  103 option (NN_TESTS "Build and run nanomsg tests" ON)
  104 option (NN_TOOLS "Build nanomsg tools" ON)
  105 option (NN_ENABLE_NANOCAT "Enable building nanocat utility." ${NN_TOOLS})
  106 set (NN_MAX_SOCKETS 512 CACHE STRING "max number of nanomsg sockets that can be created")
  107 
  108 #  Platform checks.
  109 
  110 if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
  111     set(NN_WARN_FLAGS "-Wall -Wextra")
  112 elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
  113     set(NN_WARN_FLAGS "-Wall -Wextra")
  114 elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
  115     set(NN_WARN_FLAGS "-Wall -Wextra")
  116 endif()
  117 
  118 if (NN_ENABLE_COVERAGE)
  119     # NB: This only works for GCC and Clang 3.0 and newer.  If your stuff
  120     # is older than that, you will need to find something newer.  For
  121     # correct reporting, we always turn off all optimizations.
  122     if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
  123         set(NN_COVERAGE_FLAGS "-g -O0 --coverage")
  124     elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
  125         set(NN_COVERAGE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
  126     elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
  127         set(NN_COVERAGE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
  128     else()
  129         message(FATAL_ERROR "Unable to enable coverage for your compiler.")
  130     endif()
  131 endif()
  132 
  133 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NN_WARN_FLAGS} ${NN_COVERAGE_FLAGS}")
  134 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NN_WARN_FLAGS} ${NN_COVERAGE_FLAGS}")
  135 
  136 find_package (Threads REQUIRED)
  137 
  138 message(STATUS "OS System is ${CMAKE_SYSTEM_NAME}")
  139 message(STATUS "OS Version is ${CMAKE_SYSTEM_VERSION}")
  140 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
  141     add_definitions (-DNN_HAVE_LINUX)
  142     if (CMAKE_SYSTEM_VERSION MATCHES "Microsoft")
  143         add_definitions (-DNN_HAVE_WSL)
  144     endif()
  145 elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
  146     add_definitions (-DNN_HAVE_ANDROID)
  147     add_definitions (-DNN_HAVE_LINUX)
  148 elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
  149     add_definitions (-DNN_HAVE_OSX)
  150 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
  151     set (NN_HAVE_WINSOCK 1)
  152     add_definitions (-DNN_HAVE_WINDOWS)
  153     add_definitions (-D_CRT_SECURE_NO_WARNINGS)
  154 
  155     # Target Windows Vista and later
  156     add_definitions (-D_WIN32_WINNT=0x0600)
  157     list (APPEND CMAKE_REQUIRED_DEFINITIONS -D_WIN32_WINNT=0x0600)
  158 elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
  159     add_definitions (-DNN_HAVE_FREEBSD)
  160 elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
  161     add_definitions (-DNN_HAVE_NETBSD)
  162 elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
  163     add_definitions (-DNN_HAVE_OPENBSD)
  164 elseif (CMAKE_SYSTEM_NAME MATCHES "Solaris|SunOS")
  165     add_definitions (-DNN_HAVE_SOLARIS)
  166 elseif (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
  167     add_definitions (-DNN_HAVE_HPUX)
  168 elseif (CMAKE_SYSTEM_NAME MATCHES "QNX")
  169     add_definitions (-DNN_HAVE_QNX)
  170 else ()
  171     message (AUTHOR_WARNING "WARNING: This platform may or may not be supported: ${CMAKE_SYSTEM_NAME}")
  172     message (AUTHOR_WARNING "${ISSUE_REPORT_MSG}")
  173 endif ()
  174 
  175 if (NN_STATIC_LIB)
  176     add_definitions (-DNN_STATIC_LIB)
  177 endif ()
  178 
  179 macro (nn_check_func SYM DEF)
  180     check_function_exists (${SYM} ${DEF})
  181     if (${DEF})
  182         add_definitions (-D${DEF}=1)
  183     endif ()
  184 endmacro (nn_check_func)
  185 
  186 macro (nn_check_sym SYM HDR DEF)
  187     check_symbol_exists (${SYM} ${HDR} ${DEF})
  188     if (${DEF})
  189         add_definitions (-D${DEF}=1)
  190     endif ()
  191 endmacro (nn_check_sym)
  192 
  193 macro (nn_check_lib LIB SYM DEF)
  194     check_library_exists (${LIB} ${SYM} "" ${DEF})
  195     if (${DEF})
  196         add_definitions (-D${DEF}=1)
  197         set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} ${LIB})
  198     endif ()
  199 endmacro (nn_check_lib)
  200 
  201 macro (nn_check_struct_member STR MEM HDR DEF)
  202     check_struct_has_member ("struct ${STR}" ${MEM} ${HDR} ${DEF})
  203     if (${DEF})
  204         add_definitions (-D${DEF}=1)
  205     endif ()
  206 endmacro (nn_check_struct_member)
  207 
  208 if (WIN32)
  209     # Windows is a special snowflake.
  210     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} ws2_32)
  211     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} mswsock)
  212     set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} advapi32)
  213     nn_check_sym (InitializeConditionVariable windows.h NN_HAVE_CONDVAR)
  214     if (NOT NN_HAVE_CONDVAR)
  215         message (FATAL_ERROR
  216 	    "Modern Windows API support is missing. "
  217 	    "Versions of Windows prior to Vista are not supported.  "
  218 	    "Further, the 32-bit MinGW environment is not supported. "
  219 	    "Ensure you have at least Windows Vista or newer, and are "
  220 	    "using either Visual Studio 2010 or newer or MinGW-W64.")
  221     endif()
  222 else ()
  223     # Unconditionally declare the following feature test macros.  These are
  224     # needed for some platforms (glibc and SunOS/illumos) and should be harmless
  225     # on the others.
  226     add_definitions (-D_GNU_SOURCE)
  227     add_definitions (-D_REENTRANT)
  228     add_definitions (-D_THREAD_SAFE)
  229     add_definitions (-D_POSIX_PTHREAD_SEMANTICS)
  230 
  231     nn_check_func (gethrtime NN_HAVE_GETHRTIME)
  232     nn_check_func (socketpair NN_HAVE_SOCKETPAIR)
  233     nn_check_func (eventfd NN_HAVE_EVENTFD)
  234     nn_check_func (pipe NN_HAVE_PIPE)
  235     nn_check_func (pipe2 NN_HAVE_PIPE2)
  236     nn_check_func (accept4 NN_HAVE_ACCEPT4)
  237     nn_check_func (epoll_create NN_HAVE_EPOLL)
  238     nn_check_func (kqueue NN_HAVE_KQUEUE)
  239     nn_check_func (poll NN_HAVE_POLL)
  240 
  241     nn_check_lib (anl getaddrinfo_a NN_HAVE_GETADDRINFO_A)
  242     nn_check_lib (rt clock_gettime  NN_HAVE_CLOCK_GETTIME)
  243     nn_check_lib (rt sem_wait NN_HAVE_SEMAPHORE_RT)
  244     nn_check_lib (pthread sem_wait  NN_HAVE_SEMAPHORE_PTHREAD)
  245     nn_check_lib (nsl gethostbyname NN_HAVE_LIBNSL)
  246     nn_check_lib (socket socket NN_HAVE_LIBSOCKET)
  247 
  248     nn_check_sym (CLOCK_MONOTONIC time.h NN_HAVE_CLOCK_MONOTONIC)
  249     nn_check_sym (atomic_cas_32 atomic.h NN_HAVE_ATOMIC_SOLARIS)
  250     nn_check_sym (AF_UNIX sys/socket.h NN_HAVE_UNIX_SOCKETS)
  251     nn_check_sym (backtrace_symbols_fd execinfo.h NN_HAVE_BACKTRACE)
  252     nn_check_struct_member(msghdr msg_control sys/socket.h NN_HAVE_MSG_CONTROL)
  253     if (NN_HAVE_SEMAPHORE_RT OR NN_HAVE_SEMAPHORE_PTHREAD)
  254         if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
  255             # macOS doesn't have unnamed semaphores
  256             add_definitions (-DNN_HAVE_SEMAPHORE)
  257         endif()
  258     endif ()
  259 endif ()
  260 
  261 
  262 if (NOT NN_ENABLE_GETADDRINFO_A)
  263     add_definitions (-DNN_DISABLE_GETADDRINFO_A)
  264 endif ()
  265 
  266 check_c_source_compiles ("
  267     #include <stdint.h>
  268     int main()
  269     {
  270         volatile uint32_t n = 0;
  271         __sync_fetch_and_add (&n, 1);
  272         __sync_fetch_and_sub (&n, 1);
  273         return 0;
  274     }
  275 " NN_HAVE_GCC_ATOMIC_BUILTINS)
  276 if (NN_HAVE_GCC_ATOMIC_BUILTINS)
  277     add_definitions (-DNN_HAVE_GCC_ATOMIC_BUILTINS)
  278 endif ()
  279 
  280 add_definitions(-DNN_MAX_SOCKETS=${NN_MAX_SOCKETS})
  281 
  282 add_subdirectory (src)
  283 
  284 #  Build the tools
  285 
  286 if (NN_ENABLE_NANOCAT)
  287     add_executable (nanocat tools/nanocat.c tools/options.c)
  288     target_link_libraries (nanocat ${PROJECT_NAME})
  289 endif ()
  290 
  291 if (NN_ENABLE_DOC)
  292     find_program (ASCIIDOCTOR_EXE asciidoctor)
  293     if (NOT ASCIIDOCTOR_EXE)
  294         message (WARNING "Could not find asciidoctor: skipping docs")
  295         set (NN_ENABLE_DOC OFF)
  296     else ()
  297         message (STATUS "Using asciidoctor at ${ASCIIDOCTOR_EXE}")
  298     endif ()
  299 endif ()
  300 
  301 # Build the documenation
  302 if (NN_ENABLE_DOC)
  303 
  304     set (NN_DOCDIR ${CMAKE_CURRENT_SOURCE_DIR}/doc)
  305     set (NN_STYLESHEET ${NN_DOCDIR}/stylesheet.css)
  306     set (NN_TITLE ${PROJECT_NAME} ${NN_PACKAGE_VERSION})
  307     set (NN_A2M ${ASCIIDOCTOR_EXE} -b manpage -amanmanual='${NN_TITLE}')
  308     set (NN_A2H ${ASCIIDOCTOR_EXE} -d manpage -b html5 -a stylesheeet=${NN_STYLESHEET} -aversion-label=${PROJECT_NAME} -arevnumber=${NN_PACKAGE_VERSION})
  309 
  310     macro (add_libnanomsg_man NAME SECT)
  311         add_custom_command (
  312             OUTPUT ${NAME}.${SECT}
  313             COMMAND ${NN_A2M} -o ${NAME}.${SECT} ${NN_DOCDIR}/${NAME}.adoc
  314             MAIN_DEPENDENCY ${NN_DOCDIR}/${NAME}.adoc
  315         )
  316 
  317         add_custom_command (
  318             OUTPUT ${NAME}.html
  319             COMMAND ${NN_A2H} -o ${NAME}.html ${NN_DOCDIR}/${NAME}.adoc
  320             DEPENDS ${NN_STYLESHEET}
  321             MAIN_DEPENDENCY ${NN_DOCDIR}/${NAME}.adoc
  322         )
  323 
  324         set(NN_MANS ${NN_MANS} ${NAME}.${SECT})
  325         set(NN_HTMLS ${NN_HTMLS} ${NAME}.html)
  326 
  327         install (
  328             FILES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.html
  329             DESTINATION ${CMAKE_INSTALL_DOCDIR}
  330         )
  331         install (
  332             FILES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.${SECT}
  333             DESTINATION ${CMAKE_INSTALL_MANDIR}/man${SECT}
  334         )
  335 
  336     endmacro (add_libnanomsg_man)
  337 
  338     if (NN_ENABLE_NANOCAT)
  339         add_libnanomsg_man (nanocat 1)
  340     endif ()
  341 
  342     add_libnanomsg_man (nn_errno 3)
  343     add_libnanomsg_man (nn_strerror 3)
  344     add_libnanomsg_man (nn_symbol 3)
  345     add_libnanomsg_man (nn_symbol_info 3)
  346     add_libnanomsg_man (nn_allocmsg 3)
  347     add_libnanomsg_man (nn_reallocmsg 3)
  348     add_libnanomsg_man (nn_freemsg 3)
  349     add_libnanomsg_man (nn_socket 3)
  350     add_libnanomsg_man (nn_close 3)
  351     add_libnanomsg_man (nn_get_statistic 3)
  352     add_libnanomsg_man (nn_getsockopt 3)
  353     add_libnanomsg_man (nn_setsockopt 3)
  354     add_libnanomsg_man (nn_bind 3)
  355     add_libnanomsg_man (nn_connect 3)
  356     add_libnanomsg_man (nn_shutdown 3)
  357     add_libnanomsg_man (nn_send 3)
  358     add_libnanomsg_man (nn_recv 3)
  359     add_libnanomsg_man (nn_sendmsg 3)
  360     add_libnanomsg_man (nn_recvmsg 3)
  361     add_libnanomsg_man (nn_device 3)
  362     add_libnanomsg_man (nn_cmsg 3)
  363     add_libnanomsg_man (nn_poll 3)
  364     add_libnanomsg_man (nn_term 3)
  365 
  366     add_libnanomsg_man (nanomsg 7)
  367     add_libnanomsg_man (nn_pair 7)
  368     add_libnanomsg_man (nn_reqrep 7)
  369     add_libnanomsg_man (nn_pubsub 7)
  370     add_libnanomsg_man (nn_survey 7)
  371     add_libnanomsg_man (nn_pipeline 7)
  372     add_libnanomsg_man (nn_bus 7)
  373     add_libnanomsg_man (nn_inproc 7)
  374     add_libnanomsg_man (nn_ipc 7)
  375     add_libnanomsg_man (nn_tcp 7)
  376     add_libnanomsg_man (nn_ws 7)
  377     add_libnanomsg_man (nn_env 7)
  378 
  379     add_custom_target (man ALL DEPENDS ${NN_MANS})
  380     add_custom_target (html ALL DEPENDS ${NN_HTMLS})
  381 
  382 endif ()
  383 
  384 #  Build unit tests.
  385 
  386 if (NN_TESTS)
  387 
  388     enable_testing ()
  389     set (all_tests "")
  390 
  391     set (TEST_PORT 12100)
  392     macro (add_libnanomsg_test NAME TIMEOUT)
  393         list (APPEND all_tests ${NAME})
  394         add_executable (${NAME} tests/${NAME}.c)
  395         target_link_libraries (${NAME} ${PROJECT_NAME})
  396         add_test (NAME ${NAME} COMMAND ${NAME} ${TEST_PORT})
  397         set_tests_properties (${NAME} PROPERTIES TIMEOUT ${TIMEOUT})
  398         math (EXPR TEST_PORT "${TEST_PORT}+10")
  399     endmacro (add_libnanomsg_test)
  400 
  401     #  Transport tests.
  402     add_libnanomsg_test (inproc 5)
  403     add_libnanomsg_test (inproc_shutdown 5)
  404     add_libnanomsg_test (ipc 5)
  405     add_libnanomsg_test (ipc_shutdown 30)
  406     add_libnanomsg_test (ipc_stress 5)
  407     add_libnanomsg_test (tcp 20)
  408     add_libnanomsg_test (tcp_shutdown 120)
  409     add_libnanomsg_test (ws 20)
  410 
  411     #  Protocol tests.
  412     add_libnanomsg_test (pair 5)
  413     add_libnanomsg_test (pubsub 5)
  414     add_libnanomsg_test (reqrep 5)
  415     add_libnanomsg_test (pipeline 5)
  416     add_libnanomsg_test (survey 5)
  417     add_libnanomsg_test (bus 5)
  418 
  419     #  Feature tests.
  420     add_libnanomsg_test (async_shutdown 30)
  421     add_libnanomsg_test (block 5)
  422     add_libnanomsg_test (term 5)
  423     add_libnanomsg_test (timeo 5)
  424     add_libnanomsg_test (iovec 5)
  425     add_libnanomsg_test (msg 5)
  426     add_libnanomsg_test (prio 5)
  427     add_libnanomsg_test (poll 5)
  428     add_libnanomsg_test (device 5)
  429     add_libnanomsg_test (device4 5)
  430     add_libnanomsg_test (device5 5)
  431     add_libnanomsg_test (device6 5)
  432     add_libnanomsg_test (device7 30)
  433     add_libnanomsg_test (emfile 5)
  434     add_libnanomsg_test (domain 5)
  435     add_libnanomsg_test (trie 5)
  436     add_libnanomsg_test (list 5)
  437     add_libnanomsg_test (hash 5)
  438     add_libnanomsg_test (stats 5)
  439     add_libnanomsg_test (symbol 5)
  440     add_libnanomsg_test (separation 5)
  441     add_libnanomsg_test (zerocopy 5)
  442     add_libnanomsg_test (shutdown 5)
  443     add_libnanomsg_test (cmsg 5)
  444     add_libnanomsg_test (bug328 5)
  445     add_libnanomsg_test (bug777 5)
  446     add_libnanomsg_test (ws_async_shutdown 5)
  447     add_libnanomsg_test (reqttl 10)
  448     add_libnanomsg_test (surveyttl 10)
  449 
  450     # Platform-specific tests
  451     if (WIN32)
  452         add_libnanomsg_test (win_sec_attr 5)
  453     endif()
  454 
  455     #  Build the performance tests.
  456 
  457     macro (add_libnanomsg_perf NAME)
  458         add_executable (${NAME} perf/${NAME}.c)
  459         target_link_libraries (${NAME} ${PROJECT_NAME})
  460     endmacro (add_libnanomsg_perf)
  461 
  462     add_libnanomsg_perf (inproc_lat)
  463     add_libnanomsg_perf (inproc_thr)
  464     add_libnanomsg_perf (local_lat)
  465     add_libnanomsg_perf (remote_lat)
  466     add_libnanomsg_perf (local_thr)
  467     add_libnanomsg_perf (remote_thr)
  468 
  469 endif ()
  470 
  471 install (TARGETS LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
  472 install (TARGETS ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
  473 install (FILES src/nn.h DESTINATION include/nanomsg)
  474 install (FILES src/inproc.h DESTINATION include/nanomsg)
  475 install (FILES src/ipc.h DESTINATION include/nanomsg)
  476 install (FILES src/tcp.h DESTINATION include/nanomsg)
  477 install (FILES src/ws.h DESTINATION include/nanomsg)
  478 install (FILES src/pair.h DESTINATION include/nanomsg)
  479 install (FILES src/pubsub.h DESTINATION include/nanomsg)
  480 install (FILES src/reqrep.h DESTINATION include/nanomsg)
  481 install (FILES src/pipeline.h DESTINATION include/nanomsg)
  482 install (FILES src/survey.h DESTINATION include/nanomsg)
  483 install (FILES src/bus.h DESTINATION include/nanomsg)
  484 
  485 if (NN_ENABLE_NANOCAT)
  486     install (TARGETS nanocat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  487 endif()
  488 
  489 set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
  490 set (CPACK_PACKAGE_VERSION ${NN_PACKAGE_VERSION})
  491 set (CPACK_SOURCE_GENERATOR "TBZ2;TGZ;ZIP")
  492 set (CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}")
  493 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${NN_PACKAGE_VERSION}")
  494 add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
  495 include (CPack)