diff --git a/CMakeLists.txt b/CMakeLists.txt index 98f6a770..d3daaa0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3) project( boost.numpy ) -set(BUILD_TEST ON CACHE BOOL "Build Boost.NumPy Tests") +set(BUILD_TESTS ON CACHE BOOL "Build Boost.NumPy Tests") set(BUILD_EXAMPLES ON CACHE BOOL "Build Boost.NumPy Examples") # put our local cmake find scripts at the beginning of the cmake diff --git a/libs/numpy/test/CMakeLists.txt b/libs/numpy/test/CMakeLists.txt index 0075f927..6d0e5c6e 100644 --- a/libs/numpy/test/CMakeLists.txt +++ b/libs/numpy/test/CMakeLists.txt @@ -16,11 +16,19 @@ set( TestCommand ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${runCmakeTest} ) # custom macro with most of the redundant code for making a python test macro( addPythonTest _name _srcpy ) + ADD_CUSTOM_TARGET( + ${_srcpy} ALL + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_srcpy} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_SOURCE_DIR}/${_srcpy} + ${CMAKE_CURRENT_BINARY_DIR}/${_srcpy} + ) + # make the pyd library link against boost_numpy python and boost TARGET_LINK_LIBRARIES(${_name} boost_numpy) - + # make a test of the module using the python source file in the test directory - ADD_TEST(${_name} ${TestCommand} ${TEST_SOURCE_DIR}/${_srcpy}) + ADD_TEST(${_name} ${TestCommand} ${CMAKE_CURRENT_BINARY_DIR}/${_srcpy}) # set the regex to use to recognize a failure since `python testfoo.py` # does not seem to return non-zero with a test failure