summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'bindings')
-rw-r--r--bindings/c/CMakeLists.txt6
-rw-r--r--bindings/python/CMakeLists.txt11
2 files changed, 15 insertions, 2 deletions
diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt
index b83ef6f..36b6aa9 100644
--- a/bindings/c/CMakeLists.txt
+++ b/bindings/c/CMakeLists.txt
@@ -58,5 +58,9 @@ if(BUILD_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nonnull")
target_link_libraries(cparameterUnitTest cparameter)
- add_test(cparameterUnitTest cparameterUnitTest)
+ add_test(NAME cparameterUnitTest
+ COMMAND cparameterUnitTest)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(cparameterUnitTest)
endif()
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.