aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/python/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/python/CMakeLists.txt')
-rw-r--r--bindings/python/CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 907741d..f3fc388 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -39,7 +39,16 @@ set_property(SOURCE pfw.i PROPERTY SWIG_FLAGS "-Wall" "-Werror")
swig_add_module(PyPfw python pfw.i)
swig_link_libraries(PyPfw parameter ${PYTHON_LIBRARIES})
-
+# For convenience, the global library output directory
+# (CMAKE_LIBRARY_OUTPUT_DIRECTORY) is set to ${CMAKE_BINARY_DIR}/lib, so that
+# all libs are generated in the same folder. This help writing test targets
+# (add_test) that do not need "make install" to be run.
+# However, putting _PyPfw.so in that folder defeats the purpose described
+# above because when running tests using the python bindings, the PYTHONPATH
+# needs to contain both _PyPfw.so and PyPfw.py. Without the line below,
+# _PyPfw.so would be put in ${CMAKE_BINARY_DIR}/lib while PyPfw.py is put in
+# ${CMAKE_CURRENT_BINARY_DIR}.
+set_property(TARGET _PyPfw PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# The 'unused-but-set-variable' warning must be disabled because SWIG generates
# files that do not respect that contraint.