<div dir="ltr">I'm currently working on protobuf-3.0.0's cmake scripts, and I've hit a bit of a chicken and egg problem.<div><br></div><div>There is an examples directory containing a CMakeLists.txt which we would like to work as both a standalone examples directory and include as a sub directory of the full build. For obvious reasons, the CMakeLists.txt file contains a call to find_package(protobuf). </div><div><br></div><div>I can call find_package(protobuf HINTS ${CMAKE_BINARY_DIR}) outside of the examples/CMakeLists.txt file to ensure that we've already found the correct version, but the problem is that the protobuf-config.cmake file includes the export-generated file protobuf-targets.cmake, as well as implementing some custom functions that we want to show off as part of the examples.</div><div><br></div><div>The obvious solution to me was to use the export command to generate protobuf-targets.cmake, but there are 2 problems. First, export(EXPORT) doesn't create a file until generation time, but I can get around this using export(TARGETS). The second is that, reading <span style="line-height:1.5">CMP0024, this appears to be not garunted behavior, and actively discouraged.</span></div><div><br></div><div>What would be the suggested way to handle this?</div></div>