diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2017-09-01 10:07:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-01 10:07:43 -0400 |
commit | b3a1f87f0c5f75d74c2e39f7d9322c3a0a29b9f2 (patch) | |
tree | 18435701302a4af7fa79a0032bc19c147fac9c07 | |
parent | 69e794ca75e6c07ad78a8f7467c267be9ac08921 (diff) | |
parent | 2a720ac1bbd6dd0d14022bedf7a0c3629863b916 (diff) | |
download | googletest-b3a1f87f0c5f75d74c2e39f7d9322c3a0a29b9f2.tar.gz googletest-b3a1f87f0c5f75d74c2e39f7d9322c3a0a29b9f2.tar.bz2 googletest-b3a1f87f0c5f75d74c2e39f7d9322c3a0a29b9f2.zip |
Merge pull request #1235 from aninf-wo/hethi/issue-1175-cmake-build-type
use cmake build type defined in .travis.yml for travis builds
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 32 | ||||
-rwxr-xr-x | travis.sh | 1 |
3 files changed, 24 insertions, 13 deletions
diff --git a/.travis.yml b/.travis.yml index c155e571..417d2c51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,8 +36,8 @@ compiler: script: ./travis.sh env: matrix: - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 - - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE=1 CXX_FLAGS=-std=c++11 + - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 + - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11 notifications: email: false sudo: false diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index f0f54d02..ec5d08c0 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -236,23 +236,33 @@ endfunction() # creates a Python test with the given name whose main module is in # test/name.py. It does nothing if Python is not installed. function(py_test name) - # We are not supporting Python tests on Linux yet as they consider - # all Linux environments to be google3 and try to use google3 features. 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() @@ -8,6 +8,7 @@ cmake -Dgtest_build_samples=ON \ -Dgtest_build_tests=ON \ -Dgmock_build_tests=ON \ -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ .. make CTEST_OUTPUT_ON_FAILURE=1 make test |