capnproto

FORK: Cap'n Proto serialization/RPC system - core tools and C++ library
git clone https://git.neptards.moe/neptards/capnproto.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (1742B)


      1 
      2 # Tests ========================================================================
      3 
      4 if(BUILD_TESTING)
      5   include(CTest)
      6 
      7   if(EXTERNAL_CAPNP)
      8     # Set up CAPNP_GENERATE_CPP for compiling test schemas
      9     find_package(CapnProto CONFIG QUIET)
     10     if(NOT CapnProto_FOUND)
     11       # No working installation of Cap'n Proto found, so fall back to searching the environment.
     12       #
     13       # We search for the external capnp compiler binaries via $CAPNP, $CAPNPC_CXX, and
     14       # find_program(). find_program() will use various paths in its search, among them
     15       # ${CMAKE_PREFIX_PATH}/bin and $PATH.
     16 
     17       if(NOT CAPNP_EXECUTABLE)
     18         if(DEFINED ENV{CAPNP})
     19           set(CAPNP_EXECUTABLE "$ENV{CAPNP}")
     20         else()
     21           find_program(CAPNP_EXECUTABLE capnp)
     22         endif()
     23       endif()
     24 
     25       if(NOT CAPNPC_CXX_EXECUTABLE)
     26         if(DEFINED ENV{CAPNPC_CXX})
     27           set(CAPNPC_CXX_EXECUTABLE "$ENV{CAPNPC_CXX}")
     28         else()
     29           # Also search in the same directory that `capnp` was found in
     30           get_filename_component(capnp_dir "${CAPNP_EXECUTABLE}" DIRECTORY)
     31           find_program(CAPNPC_CXX_EXECUTABLE capnpc-c++ HINTS "${capnp_dir}")
     32         endif()
     33       endif()
     34     endif()
     35 
     36     set(CAPNP_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
     37     #TODO(someday) It would be nice to use targets instead of variables in CAPNP_GENERATE_CPP macro
     38   endif()
     39 
     40   # Sadly, we can't use the 'test' target, as that's coopted by ctest
     41   add_custom_target(check "${CMAKE_CTEST_COMMAND}" -V)
     42 endif()  # BUILD_TESTING
     43 
     44 # kj ===========================================================================
     45 
     46 add_subdirectory(kj)
     47 
     48 # capnp ========================================================================
     49 
     50 add_subdirectory(capnp)