Commit c8ebd474 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added build with system installation of Gtest.

parent 9319e714
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -158,8 +158,19 @@ link_libraries( stdc++fs )
if( ${BUILD_TESTS} OR ${BUILD_MATRIX_TESTS} )
   enable_testing()

   if( ${WITH_SYSTEM_GTEST} OR ${OFFLINE_BUILD} )
      # find gtest installed in the local system
      find_package(GTest REQUIRED)
      if( GTEST_FOUND )
         set( CXX_TESTS_FLAGS ${CXX_TESTS_FLAGS} -DHAVE_GTEST )
         include_directories( ${GTEST_INCLUDE_DIRS} )
         link_libraries( ${GTEST_LIBRARIES} )
      endif( GTEST_FOUND )
   else()
      # build gtest libs
      include( BuildGtest )
   endif()


   if( ${WITH_COVERAGE} AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
      # enable code coverage reports
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ WITH_CUDA_ARCH="auto"
WITH_OPENMP="yes"
WITH_GMP="no"
WITH_CI_FLAGS="no"
WITH_SYSTEM_GTEST="no"

# flags affecting only tests
RUN_TESTS="yes"   # whether to run tests if they were compiled (coverage script sets it to no)
@@ -83,6 +84,7 @@ Options for the 'tests' and 'matrix-tests' targets:
    --run-tests=yes/no                    Runs unit tests if they were compiled. '$RUN_TESTS' by default.
    --tests-jobs=NUM                      Number of processes to be used for the unit tests. It is $TEST_JOBS by default.
    --with-coverage=yes/no                Enables code coverage reports for unit tests (lcov is required). '$WITH_COVERAGE' by default.
    --with-system-gtest=yes/no            Use GTest installed in the local system and do not download the latest version. '$WITH_SYSTEM_GTEST' by default.
EOF
}

@@ -117,6 +119,7 @@ for option in "$@"; do
        --tests-jobs=*        ) TESTS_JOBS="${option#*=}" ;;
        --with-coverage=*     ) WITH_COVERAGE="${option#*=}" ;;
        --with-ci-flags=*     ) WITH_CI_FLAGS="${option#*=}" ;;
        --with-system-gtest=* ) WITH_SYSTEM_GTEST="${option#*=}" ;;
        -*                    )
            echo "Unknown option $option. Use --help for more information." >&2
            exit 1
@@ -205,6 +208,7 @@ cmake_command=(
         -DWITH_GMP=${WITH_GMP}
         -DWITH_COVERAGE=${WITH_COVERAGE}
         -DWITH_CI_FLAGS=${WITH_CI_FLAGS}
         -DWITH_SYSTEM_GTEST=${WITH_SYSTEM_GTEST}
         -DBUILD_BENCHMARKS=${BUILD_BENCHMARKS}
         -DBUILD_EXAMPLES=${BUILD_EXAMPLES}
         -DBUILD_TOOLS=${BUILD_TOOLS}