|  | @@ -37,6 +37,9 @@ if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
 | 
	
		
			
				|  |  |  endif()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  # Options
 | 
	
		
			
				|  |  | +if(WITH_PROTOC)
 | 
	
		
			
				|  |  | +  set(protobuf_PROTOC_EXE ${WITH_PROTOC} CACHE FILEPATH "Protocol Buffer Compiler executable" FORCE)
 | 
	
		
			
				|  |  | +endif()
 | 
	
		
			
				|  |  |  option(protobuf_BUILD_TESTS "Build tests" ON)
 | 
	
		
			
				|  |  |  option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
 | 
	
		
			
				|  |  |  option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
 | 
	
	
		
			
				|  | @@ -58,6 +61,12 @@ mark_as_advanced(protobuf_DEBUG_POSTFIX)
 | 
	
		
			
				|  |  |  # User options
 | 
	
		
			
				|  |  |  include(protobuf-options.cmake)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +# Overrides for option dependencies
 | 
	
		
			
				|  |  | +if (protobuf_BUILD_PROTOC_BINARIES OR protobuf_BUILD_TESTS)
 | 
	
		
			
				|  |  | +  set(protobuf_BUILD_LIBPROTOC ON)
 | 
	
		
			
				|  |  | +else()
 | 
	
		
			
				|  |  | +  set(protobuf_BUILD_LIBPROTOC OFF)
 | 
	
		
			
				|  |  | +endif ()
 | 
	
		
			
				|  |  |  # Path to main configure script
 | 
	
		
			
				|  |  |  set(protobuf_CONFIGURE_SCRIPT "../configure.ac")
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -242,11 +251,29 @@ endif (protobuf_UNICODE)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  include(libprotobuf-lite.cmake)
 | 
	
		
			
				|  |  |  include(libprotobuf.cmake)
 | 
	
		
			
				|  |  | -if (protobuf_BUILD_PROTOC_BINARIES)
 | 
	
		
			
				|  |  | +if (protobuf_BUILD_LIBPROTOC)
 | 
	
		
			
				|  |  |    include(libprotoc.cmake)
 | 
	
		
			
				|  |  | +endif (protobuf_BUILD_LIBPROTOC)
 | 
	
		
			
				|  |  | +if (protobuf_BUILD_PROTOC_BINARIES)
 | 
	
		
			
				|  |  |    include(protoc.cmake)
 | 
	
		
			
				|  |  | +  if (NOT DEFINED protobuf_PROTOC_EXE)
 | 
	
		
			
				|  |  | +    set(protobuf_PROTOC_EXE protoc)
 | 
	
		
			
				|  |  | +  endif (NOT DEFINED protobuf_PROTOC_EXE)
 | 
	
		
			
				|  |  |  endif (protobuf_BUILD_PROTOC_BINARIES)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +# Ensure we have a protoc executable if we need one
 | 
	
		
			
				|  |  | +if (protobuf_BUILD_TESTS OR protobuf_BUILD_CONFORMANCE OR protobuf_BUILD_EXAMPLES)
 | 
	
		
			
				|  |  | +  if (NOT DEFINED protobuf_PROTOC_EXE)
 | 
	
		
			
				|  |  | +    find_program(protobuf_PROTOC_EXE protoc)
 | 
	
		
			
				|  |  | +    if (NOT protobuf_PROTOC_EXE)
 | 
	
		
			
				|  |  | +      message(FATAL "Build requires 'protoc' but binary not found and not building protoc.")
 | 
	
		
			
				|  |  | +    endif ()
 | 
	
		
			
				|  |  | +  endif ()
 | 
	
		
			
				|  |  | +  if(protobuf_VERBOSE)
 | 
	
		
			
				|  |  | +    message(STATUS "Using protoc : ${protobuf_PROTOC_EXE}")
 | 
	
		
			
				|  |  | +  endif(protobuf_VERBOSE)
 | 
	
		
			
				|  |  | +endif ()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  if (protobuf_BUILD_TESTS)
 | 
	
		
			
				|  |  |    include(tests.cmake)
 | 
	
		
			
				|  |  |  endif (protobuf_BUILD_TESTS)
 | 
	
	
		
			
				|  | @@ -262,5 +289,5 @@ if (protobuf_BUILD_EXAMPLES)
 | 
	
		
			
				|  |  |  endif (protobuf_BUILD_EXAMPLES)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if(protobuf_VERBOSE)
 | 
	
		
			
				|  |  | -    message(STATUS "Protocol Buffers Configuring done")
 | 
	
		
			
				|  |  | -endif()
 | 
	
		
			
				|  |  | +  message(STATUS "Protocol Buffers Configuring done")
 | 
	
		
			
				|  |  | +endif(protobuf_VERBOSE)
 |