Skip to content

Commit 30807b2

Browse files
committed
Merge pull request opencv#7644 from alalek:cmake_python_install
2 parents 12569dc + edcbc15 commit 30807b2

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

modules/python/common.cmake

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,27 +132,29 @@ endif()
132132

133133
if(NOT INSTALL_CREATE_DISTRIB AND DEFINED ${PYTHON}_PACKAGES_PATH)
134134
set(__dst "${${PYTHON}_PACKAGES_PATH}")
135-
install(TARGETS ${the_module} OPTIONAL
136-
${PYTHON_INSTALL_CONFIGURATIONS}
137-
RUNTIME DESTINATION "${__dst}" COMPONENT python
138-
LIBRARY DESTINATION "${__dst}" COMPONENT python
139-
${PYTHON_INSTALL_ARCHIVE}
140-
)
141-
else()
135+
endif()
136+
if(NOT __dst)
142137
if(DEFINED ${PYTHON}_VERSION_MAJOR)
143138
set(__ver "${${PYTHON}_VERSION_MAJOR}.${${PYTHON}_VERSION_MINOR}")
144139
elseif(DEFINED ${PYTHON}_VERSION_STRING)
145140
set(__ver "${${PYTHON}_VERSION_STRING}")
146141
else()
147142
set(__ver "unknown")
148143
endif()
149-
install(TARGETS ${the_module}
150-
CONFIGURATIONS Release
151-
RUNTIME DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
152-
LIBRARY DESTINATION python/${__ver}/${OpenCV_ARCH} COMPONENT python
153-
)
144+
if(INSTALL_CREATE_DISTRIB)
145+
set(__dst "python/${__ver}/${OpenCV_ARCH}")
146+
else()
147+
set(__dst "python/${__ver}")
148+
endif()
154149
endif()
155150

151+
install(TARGETS ${the_module}
152+
${PYTHON_INSTALL_CONFIGURATIONS}
153+
RUNTIME DESTINATION "${__dst}" COMPONENT python
154+
LIBRARY DESTINATION "${__dst}" COMPONENT python
155+
${PYTHON_INSTALL_ARCHIVE}
156+
)
157+
156158
unset(PYTHON_SRC_DIR)
157159
unset(PYTHON_CVPY_PROCESS)
158160
unset(CVPY_SUFFIX)

0 commit comments

Comments
 (0)