From 5aaddd16f2aabccf07687f1761567eb6455abe61 Mon Sep 17 00:00:00 2001 From: Adrien M Date: Fri, 20 Mar 2015 19:03:32 +0100 Subject: Dissociate 'make test' & 'make install' Possibility to run the test without having to lunch the 'make install' command. Signed-off-by: Adrien M --- bindings/c/CMakeLists.txt | 6 +++++- bindings/python/CMakeLists.txt | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'bindings') 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. -- cgit v1.1