cmake: Call get_filename_component() with DIRECTORY mode instead of PATH mode (#9614)

PATH mode is legacy alias for DIRECTORY mode (needed only for CMake <= 2.8.11):
https://cmake.org/cmake/help/latest/command/get_filename_component.html
pull/9616/head
Arfrever Frehtes Taifersar Arahesis 3 years ago committed by GitHub
parent 1722b16e03
commit bd935e101d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmake/install.cmake
  2. 6
      cmake/protobuf-config.cmake.in
  3. 2
      cmake/tests.cmake

@ -51,7 +51,7 @@ foreach(_extract_string ${_extract_strings})
string(REPLACE "\\" "/" _header ${_header}) string(REPLACE "\\" "/" _header ${_header})
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE) get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE)
get_filename_component(_extract_name ${_header} NAME) get_filename_component(_extract_name ${_header} NAME)
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH) get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY)
if(EXISTS "${_extract_from}") if(EXISTS "${_extract_from}")
install(FILES "${_extract_from}" install(FILES "${_extract_from}"
DESTINATION "${_extract_to}" DESTINATION "${_extract_to}"
@ -88,10 +88,10 @@ _protobuf_auto_list("${protobuf_SOURCE_DIR}/src/Makefile.am" nobase_dist_proto_D
foreach(_file ${nobase_dist_proto_DATA}) foreach(_file ${nobase_dist_proto_DATA})
get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE) get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE)
get_filename_component(_file_name ${_file} NAME) get_filename_component(_file_name ${_file} NAME)
get_filename_component(_file_path ${_file} PATH) get_filename_component(_dir ${_file} DIRECTORY)
if(EXISTS "${_file_from}") if(EXISTS "${_file_from}")
install(FILES "${_file_from}" install(FILES "${_file_from}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_file_path}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dir}"
COMPONENT protobuf-protos COMPONENT protobuf-protos
RENAME "${_file_name}") RENAME "${_file_name}")
else() else()

@ -84,10 +84,10 @@ function(protobuf_generate)
# Create an include path for each file specified # Create an include path for each file specified
foreach(_file ${protobuf_generate_PROTOS}) foreach(_file ${protobuf_generate_PROTOS})
get_filename_component(_abs_file ${_file} ABSOLUTE) get_filename_component(_abs_file ${_file} ABSOLUTE)
get_filename_component(_abs_path ${_abs_file} PATH) get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
list(FIND _protobuf_include_path ${_abs_path} _contains_already) list(FIND _protobuf_include_path ${_abs_dir} _contains_already)
if(${_contains_already} EQUAL -1) if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${_abs_path}) list(APPEND _protobuf_include_path -I ${_abs_dir})
endif() endif()
endforeach() endforeach()
endif() endif()

@ -92,7 +92,7 @@ set(tests_protos
) )
macro(compile_proto_file filename) macro(compile_proto_file filename)
get_filename_component(dirname ${filename} PATH) get_filename_component(dirname ${filename} DIRECTORY)
get_filename_component(basename ${filename} NAME_WE) get_filename_component(basename ${filename} NAME_WE)
add_custom_command( add_custom_command(
OUTPUT ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.pb.cc OUTPUT ${protobuf_SOURCE_DIR}/src/${dirname}/${basename}.pb.cc

Loading…
Cancel
Save