1. 05 Aug, 2018 2 commits
    • Kenton Varda's avatar
      cmake: cxx_std_14 -> cxx_generic_lambdas · d7a3e49c
      Kenton Varda authored
      Apparently, this is compatible with older versions of cmake, while having the same effect. Apparently, the cmake people spent some time refuling to let people specify C++ standard versions and instead insisted that they specify specific features instead. They did not see the light until cmake 3.8, but that's too new for us to require yet, I guess.
      d7a3e49c
    • Kenton Varda's avatar
      We now require C++14. · 66730ef6
      Kenton Varda authored
      I'm tired of working around missing features that were added in C++14. It's four years old now, compilers should support it.
      66730ef6
  2. 13 Jul, 2018 1 commit
    • Harris Hancock's avatar
      cmake: Use search-specific-dirs-then-system-dirs idiom · df0fbbe3
      Harris Hancock authored
      An inconsistency was introduced with the previous fix to allow Cap'n Proto
      installations in system directories to be found by CapnProtoTargets.cmake:
      if the user installed Cap'n Proto in two locations, one of which is a
      system directory, e.g. /usr and /somewhere/else, and set
      PKG_CONFIG_PATH=/somewhere/else/lib/pkgconfig, the dependent project
      would use headers from /somewhere/else/include, but libraries from /usr/lib.
      
      This change resolves the inconsistency, allowing PKG_CONFIG_PATH to solely
      control the location of the desired installation of Cap'n Proto.
      df0fbbe3
  3. 22 May, 2018 1 commit
    • Ivan Shapovalov's avatar
      cmake: drop NO_DEFAULT_PATHS when searching libraries · 25b306ef
      Ivan Shapovalov authored
      It looks like pkg-config silently drops -I and -L flags pointing to
      default directories:
      
      ```
      $ cat /usr/lib/pkgconfig/capnp.pc
      prefix=/usr
      exec_prefix=${prefix}
      libdir=${exec_prefix}/lib
      includedir=${prefix}/include
      
      Name: Cap'n Proto
      Description: Insanely fast serialization system
      Version: 0.7-dev
      Libs: -L${libdir} -lcapnp -pthread  -lpthread
      Libs.private:  -lpthread
      Requires: kj = 0.7-dev
      Cflags: -I${includedir} -pthread
      
      $ pkg-config --libs capnp
      -lcapnp -pthread -lpthread -lkj -pthread -lpthread
      ```
      
      Ideally, however, we should use FindPkgConfig.cmake's own facilities
      to generate IMPORTED targets from pkg-config files.
      25b306ef
  4. 21 Dec, 2017 2 commits
    • Harris Hancock's avatar
      cmake: Remove FindCapnProto.cmake · 6b788321
      Harris Hancock authored
      This file is obsoleted by the CMake config package files that the autotools build now installs. Since FindCapnProto.cmake contains an implementation of capnp_generate_cpp(), in which I just fixed a bug, this file seems like a maintenance liability  now, so I'd like to delete it.
      6b788321
    • Harris Hancock's avatar
      cmake: capnp_generate_cpp() should import src-prefix · cb482fe3
      Harris Hancock authored
      capnp_generate_cpp() needs to import two directories by default: the src-prefix directory which houses the .capnp files being compiled (under their canonical paths), and the capnp include directory which houses capnp/rpc.capnp, capnp/schema.capnp, etc. (This latter path will necessarily be different for build-tree usage versus install-tree usage.) Before this commit, instead of importing the src-prefix, we were importing CMAKE_CURRENT_SOURCE_DIR.
      
      Note that for capnproto's own compilation of test.capnp and friends, the src-prefix and capnp include directory will end up being the exact same directory. It turns out to be surprisingly difficult to de-duplicate them, however, because the capnp include directory is actually a CMake generator expression in order to deal with the build-tree versus install-tree issue mentioned above. So, for now, we pass two -I flags to the same directory.
      
      Alongside the fix in capnp_generate_cpp(), I fixed the usage of it in c++/src/capnp/CMakeLists.txt by setting CAPNPC_SRC_PREFIX correctly and removing the /capnp suffix hack from CAPNPC_OUTPUT_DIR.
      cb482fe3
  5. 20 Nov, 2017 1 commit
    • Harris Hancock's avatar
      capnp_generate_cpp: Fix input file existence check · ae8859ce
      Harris Hancock authored
      capnp_generate_cpp() checks that input schema files exist at configure-time, and reports a fatal error if they don't exist. However, the check prepended the value of CAPNPC_SRC_PREFIX to input file paths, which is the wrong thing to do: the input file paths should be checked as-is if they are absolute paths, and checked relative to the current source directory, NOT the value of capnp's src-prefix flag, if they are relative paths, in order to match the capnp tool's behavior.
      
      It turns out that it's easiest to just unconditionally convert the input file paths to absolute paths, then check the absolute path. The reason is that we can't even pass relative paths to the capnp command, anyway: capnp interprets relative path inputs relative to its working directory, which defaults to the build dir. For consistency with other CMake commands (add_library, add_executable, etc.), it makes most sense if relative file path inputs to capnp_generate_cpp() are interpreted relative to the current source directory. This means that relative path inputs need to be converted to absolute paths before being fed to capnp, which was done right after the faulty existence check.
      
      This commit fixes the issue by modifying the existence check to check the path only after it's been converted to absolute form.
      
      Closes #586.
      ae8859ce
  6. 07 Nov, 2017 5 commits
  7. 28 Apr, 2017 1 commit
  8. 17 Apr, 2017 1 commit
    • Harris Hancock's avatar
      Leave CAPNP{,C_CXX}_EXECUTABLE unset if tools aren't built · d3095dd6
      Harris Hancock authored
      When building Cap'n Proto with compilers which can't yet build the command
      line tools (MSVC), the exported targets capnp_tool and capnpc_cpp don't
      exist, thus attempting to use them in a generator expression when setting
      CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE causes a hard error.
      
      Leaving the variables unset provides users the opportunity to set
      CAPNP_EXECUTABLE and CAPNPC_CXX_EXECUTABLE manually in CMake projects
      consuming Cap'n Proto as a CMake package, and produces a less mystifying
      error message if the user forgets.
      
      Thanks to Philip Quinn for advice on this issue.
      d3095dd6
  9. 03 May, 2016 1 commit
  10. 27 Apr, 2016 1 commit
  11. 19 Apr, 2016 3 commits
  12. 11 Apr, 2016 1 commit
    • Alex Richardson's avatar
      Add a cmake package config module · f7d685be
      Alex Richardson authored
      This makes it a lot easier for CMake based projects to use Cap'n Proto.
      
      Example usage:
      
      find_package(CapnProto)
      capnp_generate_cpp(FOO_SRCS FOO_HDRS foo.capnp)
      add_executable(foo main.cpp ${FOO_SRCS})
      target_link_libraries(foo CapnProto::capnp CapnProto::capnp-rpc)
      
      This is a lot better than the previous variable based solution since
      linking to nonexistent targets is an error whereas an empty variable
      expansion (e.g. due to typos) will be silently ignored. It also makes
      sure that the right compiler flags, include directories, defines and
      link libraries are passed to the compiler for that target without
      needing any other include_directories(), etc.
      f7d685be
  13. 29 Mar, 2016 1 commit
  14. 26 Jan, 2016 1 commit
  15. 12 Dec, 2014 1 commit
    • Kenton Varda's avatar
      Move cmake files into c++ subdir. · 04fd66e2
      Kenton Varda authored
      The idea behind the directory organization was that we might have official implementations for other languages in other top-level directories, as siblings to the c++ directory. It seems implausible that we'd use CMake as a meta-build-system over all of these.
      
      Another reason for this change is that the release tarball actually contains only the c++ subdirectory. We probably want to include cmake files in the release.
      04fd66e2