aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--bindings/c/CMakeLists.txt6
-rw-r--r--bindings/python/CMakeLists.txt11
-rw-r--r--test/test-fixed-point-parameter/CMakeLists.txt3
-rw-r--r--test/tokenizer/CMakeLists.txt6
5 files changed, 33 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e42b6be..e5614a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,9 @@ project(parameter-framework)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+
option(COVERAGE "Build with coverage support" OFF)
if(COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
@@ -55,6 +58,13 @@ include(CTest)
# Ctest requires its configuration to be placed at the build root
configure_file(CTestCustom.cmake ${CMAKE_BINARY_DIR} COPYONLY)
+function(set_test_env TestName)
+ set_property(TEST ${TestName} PROPERTY ENVIRONMENT
+ PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}
+ LD_LIBRARY_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}
+ PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python:$ENV{PYTHONPATH})
+endfunction()
+
add_subdirectory(test/test-platform)
add_subdirectory(test/test-fixed-point-parameter)
add_subdirectory(test/tokenizer)
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.
diff --git a/test/test-fixed-point-parameter/CMakeLists.txt b/test/test-fixed-point-parameter/CMakeLists.txt
index b9c8af3..64b51f3 100644
--- a/test/test-fixed-point-parameter/CMakeLists.txt
+++ b/test/test-fixed-point-parameter/CMakeLists.txt
@@ -32,4 +32,7 @@ if (BUILD_TESTING)
add_test(NAME fix_point_parameter
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${python2} Main.py)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(fix_point_parameter)
endif()
diff --git a/test/tokenizer/CMakeLists.txt b/test/tokenizer/CMakeLists.txt
index f68f6a3..8a00cb9 100644
--- a/test/tokenizer/CMakeLists.txt
+++ b/test/tokenizer/CMakeLists.txt
@@ -44,5 +44,9 @@ if(BUILD_TESTING)
include_directories(${PROJECT_SOURCE_DIR}/utility)
target_link_libraries(tokenizerTest pfw_utility)
- add_test(tokenizerTest tokenizerTest)
+ add_test(NAME tokenizerTest
+ COMMAND tokenizerTest)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(tokenizerTest)
endif()