Skip to content

Commit dec36f0

Browse files
committed
fix cmake error on windows from tools.cmake on cmake 3.16.0
1 parent c6a8300 commit dec36f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/tools.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ function(patch_protobuf_targets)
9494
endfunction()
9595

9696
function(project_build_tools_get_imported_location OUTPUT_VAR_NAME TARGET_NAME)
97+
98+
# The following if statement was added to support cmake versions < 3.19
99+
get_target_property(TARGET_TYPE ${TARGET_NAME} TYPE)
100+
if(TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
101+
# For interface libraries, do not attempt to retrieve imported location.
102+
set(${OUTPUT_VAR_NAME} "" PARENT_SCOPE)
103+
return()
104+
endif()
105+
97106
if(CMAKE_BUILD_TYPE)
98107
string(TOUPPER "IMPORTED_LOCATION_${CMAKE_BUILD_TYPE}"
99108
TRY_SPECIFY_IMPORTED_LOCATION)

0 commit comments

Comments
 (0)