mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Add an explicit CMake error message on missing googletest submodule
- build.bat now exit on error instead of trying to build or run tests
This commit is contained in:
parent
223c14139b
commit
2b36f52b6e
@ -252,6 +252,9 @@ if (SQLITECPP_BUILD_TESTS)
|
|||||||
# add the subdirectory containing the CMakeLists.txt for the gtest library
|
# add the subdirectory containing the CMakeLists.txt for the gtest library
|
||||||
# TODO: under Linux, uses libgtest-dev if found
|
# TODO: under Linux, uses libgtest-dev if found
|
||||||
# TODO: move to the new googletest Github repository
|
# TODO: move to the new googletest Github repository
|
||||||
|
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
|
||||||
|
message(FATAL_ERROR "Missing 'googletest' submodule! Either use 'git init submodule' and 'git update submodule' to get googletest according to the README, or deactivate unit tests with -DSQLITECPP_BUILD_TESTS=OFF")
|
||||||
|
endif ()
|
||||||
add_subdirectory(googletest)
|
add_subdirectory(googletest)
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/googletest/include")
|
include_directories("${PROJECT_SOURCE_DIR}/googletest/include")
|
||||||
|
|
||||||
|
@ -7,11 +7,19 @@ cd build
|
|||||||
|
|
||||||
@REM Generate a Visual Studio solution for latest version found
|
@REM Generate a Visual Studio solution for latest version found
|
||||||
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
cmake -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
@REM Build default configuration (ie 'Debug')
|
@REM Build default configuration (ie 'Debug')
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
@REM Build and run tests
|
@REM Build and run tests
|
||||||
ctest --output-on-failure
|
ctest --output-on-failure
|
||||||
|
if ERRORLEVEL 1 goto onError
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
exit
|
||||||
|
|
||||||
|
:onError
|
||||||
|
@echo An error occured!
|
||||||
|
cd ..
|
6
build.sh
6
build.sh
@ -1,12 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
# Copyright (c) 2012-2016 Sébastien Rombauts (sebastien.rombauts@gmail.com)
|
# Copyright (c) 2012-2016 Sébastien Rombauts (sebastien.rombauts@gmail.com)
|
||||||
#
|
#
|
||||||
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||||
# or copy at http://opensource.org/licenses/MIT)
|
# or copy at http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
# exit on firts error
|
||||||
|
set -e
|
||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
# Generate a Makefile for GCC (or Clang, depanding on CC/CXX envvar)
|
# Generate a Makefile for GCC (or Clang, depanding on CC/CXX envvar)
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_GCOV=OFF -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
cmake -DCMAKE_BUILD_TYPE=Debug -DSQLITECPP_USE_GCOV=OFF -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON ..
|
||||||
|
if [ $? != 0 ] ; then exit
|
||||||
|
|
||||||
# Build (ie 'make')
|
# Build (ie 'make')
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user