Skip to content

Commit b031eed

Browse files
committed
cmake: fix broken Python modules when more than one version was built
They were built in the same directory with the same name, so they were overwriting each other.
1 parent fa4864e commit b031eed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ macro(build_pycsdiff version boost_python_lib_names)
148148
PRIVATE ${Python${version}_INCLUDE_DIRS})
149149
target_link_libraries(pycsdiff_py${version} PRIVATE ${BOOST_PYTHON${version}})
150150

151-
# remove 'lib' prefix so that `python -c 'import pycsdiff' works`
151+
# set correct name so that `python -c 'import pycsdiff' works`
152152
set_target_properties(pycsdiff_py${version} PROPERTIES
153-
PREFIX "" OUTPUT_NAME "pycsdiff")
153+
PREFIX ""
154+
OUTPUT_NAME "pycsdiff"
155+
# to avoid overwrites with multiple Python versions
156+
LIBRARY_OUTPUT_DIRECTORY "pycsdiff_py${version}")
154157

155158
install(TARGETS pycsdiff_py${version}
156159
DESTINATION ${Python${version}_SITEARCH})

0 commit comments

Comments
 (0)