Commit d3095dd6 authored by Harris Hancock's avatar Harris Hancock

Leave CAPNP{,C_CXX}_EXECUTABLE unset if tools aren't built

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.
parent 5a842595
......@@ -12,8 +12,10 @@
set(CapnProto_VERSION @VERSION@)
set(CAPNP_EXECUTABLE $<TARGET_FILE:CapnProto::capnp_tool>)
set(CAPNPC_CXX_EXECUTABLE $<TARGET_FILE:CapnProto::capnpc_cpp>)
if(@CAPNP_BUILD_TOOLS@)
set(CAPNP_EXECUTABLE $<TARGET_FILE:CapnProto::capnp_tool>)
set(CAPNPC_CXX_EXECUTABLE $<TARGET_FILE:CapnProto::capnpc_cpp>)
endif()
set(CAPNP_INCLUDE_DIRECTORY "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
# work around http://public.kitware.com/Bug/view.php?id=15258
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment