|
@@ -81,8 +81,6 @@ function(protobuf_generate)
|
|
list(APPEND _protobuf_include_path -I ${_abs_path})
|
|
list(APPEND _protobuf_include_path -I ${_abs_path})
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
- else()
|
|
|
|
- set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
foreach(DIR ${protobuf_generate_IMPORT_DIRS})
|
|
foreach(DIR ${protobuf_generate_IMPORT_DIRS})
|
|
@@ -93,12 +91,31 @@ function(protobuf_generate)
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
|
|
|
|
|
|
+ if(NOT _protobuf_include_path)
|
|
|
|
+ set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
+ endif()
|
|
|
|
+
|
|
set(_generated_srcs_all)
|
|
set(_generated_srcs_all)
|
|
foreach(_proto ${protobuf_generate_PROTOS})
|
|
foreach(_proto ${protobuf_generate_PROTOS})
|
|
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
|
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
|
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
|
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
|
get_filename_component(_basename ${_proto} NAME_WLE)
|
|
get_filename_component(_basename ${_proto} NAME_WLE)
|
|
- file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
|
|
|
|
|
+
|
|
|
|
+ set(_suitable_include_found FALSE)
|
|
|
|
+ foreach(DIR ${_protobuf_include_path})
|
|
|
|
+ if(NOT DIR STREQUAL "-I")
|
|
|
|
+ file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir})
|
|
|
|
+ if(NOT "${_rel_dir}" MATCHES "^\.\.[/\\].*")
|
|
|
|
+ set(_suitable_include_found TRUE)
|
|
|
|
+ break()
|
|
|
|
+ endif()
|
|
|
|
+ endif()
|
|
|
|
+ endforeach()
|
|
|
|
+
|
|
|
|
+ if(NOT _suitable_include_found)
|
|
|
|
+ message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.")
|
|
|
|
+ return()
|
|
|
|
+ endif()
|
|
|
|
|
|
set(_generated_srcs)
|
|
set(_generated_srcs)
|
|
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
|
|
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
|