FindPython*: Manage weak link for Python modules

Add new target Python::Module which take care of platform requirements
for Python module development.

Fixes: #18100
This commit is contained in:
Marc Chevrier
2019-05-04 17:09:31 +02:00
parent 37bf503db2
commit 30b873c05d
21 changed files with 277 additions and 90 deletions

View File

@@ -33,7 +33,7 @@ set_target_properties (example1 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2")
target_link_libraries(example1 PRIVATE Python2::Python)
target_link_libraries(example1 PRIVATE Python2::Module)
# re-use sample interface file for another plugin
swig_add_library(example2
@@ -44,7 +44,7 @@ set_target_properties (example2 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3")
target_link_libraries(example2 PRIVATE Python3::Python)
target_link_libraries(example2 PRIVATE Python3::Module)
add_test (NAME ModuleVersion2.example1