diff options
author | Herbert Thielen <thielen@hs-worms.de> | 2017-08-30 19:17:26 +0200 |
---|---|---|
committer | Herbert Thielen <thielen@hs-worms.de> | 2017-08-30 19:17:26 +0200 |
commit | 9ba7946bde6349d9fd8621d527137c226f69bd83 (patch) | |
tree | 5229c75896c5003da6a0fb6caf3bde8a08ad744a | |
parent | 47ad2993b68250d8fd5eb604d5a88ff976bb1a3e (diff) | |
download | googletest-9ba7946bde6349d9fd8621d527137c226f69bd83.tar.gz googletest-9ba7946bde6349d9fd8621d527137c226f69bd83.tar.bz2 googletest-9ba7946bde6349d9fd8621d527137c226f69bd83.zip |
create different python based tests for single and multi configuration build generators
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index fb1fb683..ec5d08c0 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -237,20 +237,32 @@ endfunction() # test/name.py. It does nothing if Python is not installed. function(py_test name) if (PYTHONINTERP_FOUND) - # ${CMAKE_BINARY_DIR} is known at configuration time, so we can - # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known - # only at ctest runtime (by calling ctest -c <Configuration>), so - # we have to escape $ to delay variable substitution here. if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) - add_test( - NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>) + if (CMAKE_CONFIGURATION_TYPES) + # Multi-configuration build generators as for Visual Studio save + # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug, + # Release etc.), so we have to provide it here. + add_test( + NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>) + else (CMAKE_CONFIGURATION_TYPES) + # Single-configuration build generators like Makefile generators + # don't have subdirs below CMAKE_CURRENT_BINARY_DIR. + add_test( + NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + --build_dir=${CMAKE_CURRENT_BINARY_DIR}) + endif (CMAKE_CONFIGURATION_TYPES) else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) + # ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can + # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known + # only at ctest runtime (by calling ctest -c <Configuration>), so + # we have to escape $ to delay variable substitution here. add_test( ${name} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE}) endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1) - endif() + endif(PYTHONINTERP_FOUND) endfunction() |