-if( NOT SKIP_EXTERNALS )
- set( need_ext 1 ) # we force dependences on these for right build order
- execute_process( COMMAND git submodule update --init -- ext/nng
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- execute_process( COMMAND git submodule update --init -- ext/nanomsg
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
- if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ext/nng/CMakeLists.txt )
- message( FATAL_ERROR "cannot find nng in our git source as a submodule: Giving up" ) # this will abort which seems wrong, but tdam.
- endif()
-
- include( ExternalProject )
- ExternalProject_Add(
- ext_nng
- SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/nng"
- CMAKE_ARGS "-DBUILD_SHARED_LIBS=1"
- CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}"
- BUILD_COMMAND "make"
- UPDATE_COMMAND ""
- TEST_COMMAND ""
- STEP_TARGETS build
- )
- ExternalProject_Add(
- nanomsg
- SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/nanomsg"
- BUILD_COMMAND "make"
- UPDATE_COMMAND ""
- CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}"
- TEST_COMMAND ""
- STEP_TARGETS build
- )
-
- # it seems impossible to install everything that lands in {bin}/lib, so we need to
- # hard code (shudder) some things. Even worse, we have to make exceptions for
- # builds on apple (osx) since their naming convention wandered off the path.
- set( nng_major 1 )
- set( nng_minor 1.0 )
- set( nano_major 5 )
- set( nano_minor 1.0 )
- set( so ${CMAKE_SHARED_LIBRARY_SUFFIX} ) # cmake variables are impossibly long :(
- if( NOT APPLE ) # probably breaks in windows, but idc
- set( nng_so_suffix ${so} )
- set( nng_so_suffix_m ${so}.${nng_major} )
- set( nng_so_suffix_mm ${so}.${nng_major}.${nng_minor} )
-
- set( nano_so_suffix ${so} )
- set( nano_so_suffix_m ${so}.${nano_major} )
- set( nano_so_suffix_mm ${so}.${nano_major}.${nano_minor} )
- else()
- # of course apple puts versions before the suffix :(
- set( nng_so_suffix ${so} ) # so has a lead dot, so NOT needed
- set( nng_so_suffix_m ".${nng_major}${so}" ) # these need leading dots
- set( nng_so_suffix_mm ".${nng_major}.${nng_minor}${so}" )
-
- set( nano_so_suffix ${so} )
- set( nano_so_suffix_m ".${nano_major}${so}" )
- set( nano_so_suffix_mm ".${nano_major}.${nano_minor}${so}" )
- endif()
-
- message( "+++ installing nano/nng with: ${nano_major}.${nano_minor} | ${nng_major}.${nng_minor}" )