Fix python import check

for when target name is not the same as the output base name
LT1AB
Ryan Burns 2021-07-21 19:18:20 -07:00
parent e9ccc6857a
commit 52951b5a5f
1 changed files with 2 additions and 1 deletions

View File

@ -32,9 +32,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
# override this to also test the resulting extension # override this to also test the resulting extension
function(Python_add_library target) function(Python_add_library target)
_Python_add_library(${target} ${ARGN}) _Python_add_library(${target} ${ARGN})
set(name "$<TARGET_PROPERTY:${target},OUTPUT_NAME>")
add_test(NAME import_${target} add_test(NAME import_${target}
COMMAND ${Python_EXECUTABLE} -c COMMAND ${Python_EXECUTABLE} -c
"import ${target}" "import $<IF:$<BOOL:${name}>,${name},${target}>"
) )
endfunction() endfunction()
endif() endif()