cmake: Add support for custom protoc executable via OR_TOOLS_PROTOC_EXECUTABLE

Allow users to specify a custom protoc executable by setting the
OR_TOOLS_PROTOC_EXECUTABLE variable, which takes precedence over
the default cross-compilation and system protoc detection logic.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
This commit is contained in:
Clément Péron
2025-06-10 14:53:23 +02:00
committed by Corentin Le Molgat
parent 0ca1d9b8d8
commit a56a50aa00

View File

@@ -11,6 +11,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (OR_TOOLS_PROTOC_EXECUTABLE)
set(PROTOC_PRG ${OR_TOOLS_PROTOC_EXECUTABLE})
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
set(PROTOC_PRG protobuf::protoc)
return()