• Harris Hancock's avatar
    Use target_compile_features to request C++11 · 1d0d1c3b
    Harris Hancock authored
    Projects which use Cap'n Proto require C++11, because they must be able to
    compile our headers. Old gcc defaults to C++98, forcing users to manually
    specify the -std=gnu++11 flag in their CMake projects. CMake 3.1
    introduced the target_compile_features command which removes this
    necessity by automatically communicating the C++ standard level
    requirement to client projects.
    
    Specifically, if target `kj` requires a C++11 feature publicly, then all
    targets which link to `kj` will also require that C++11 feature, and get
    the -std=gnu++11 flag for free. If that target is a library, such as
    `kj-async`, and `kj-async` links publicly to `kj`, the requirement is also
    transitive to all targets which link to `kj-async`.
    
    Note that CMake's default behavior is to request compiler-specific
    extensions, such as those provided by the -std=gnu++11 flag. You must
    specifically opt out of these extensions. I'm not aware of any way to
    propagate this nuance in CMake, but added a check to at least prevent
    users from compiling Cap'n Proto without extensions.
    
    With this change, the c++/samples/CMakeLists.txt will build with MinGW
    with no change beyond requiring a later version of CMake.
    1d0d1c3b
Name
Last commit
Last update
..
cmake Loading commit data...
ekam-provider Loading commit data...
m4 Loading commit data...
samples Loading commit data...
src Loading commit data...
CMakeLists.txt Loading commit data...
LICENSE.txt Loading commit data...
Makefile.am Loading commit data...
Makefile.ekam Loading commit data...
README.txt Loading commit data...
afl-fuzz.sh Loading commit data...
capnp-json.pc.in Loading commit data...
capnp-rpc.pc.in Loading commit data...
capnp.pc.in Loading commit data...
configure.ac Loading commit data...
kj-async.pc.in Loading commit data...
kj.pc.in Loading commit data...
regenerate-bootstraps.sh Loading commit data...
setup-autotools.sh Loading commit data...
setup-ekam.sh Loading commit data...