Skip to content

Commit

Permalink
Enable testing from the top-level build directory (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
panicgh authored Apr 18, 2023
1 parent 7469230 commit 3a646f2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
include(GNUInstallDirs)
include(FeatureSummary)
include(CTest)

if(ANDROID OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
set(ANDROID ON)
Expand Down Expand Up @@ -341,7 +342,7 @@ if(INDI_BUILD_DRIVERS)

find_package(GMock)

if(GTEST_FOUND)
if(GTEST_FOUND AND BUILD_TESTING)
if(INDI_BUILD_UNITTESTS)
message(STATUS "Building unit tests")
add_subdirectory(test)
Expand All @@ -356,9 +357,11 @@ if(INDI_BUILD_DRIVERS)
message(STATUS "Not building integration tests")
endif(INDI_BUILD_INTEGTESTS)

elseif(NOT BUILD_TESTING)
message(STATUS "GTEST found, but tests disabled")
else()
message(STATUS "GTEST not found, not building tests")
endif(GTEST_FOUND)
endif(GTEST_FOUND AND BUILD_TESTING)
endif(WIN32 OR ANDROID)
endif(INDI_BUILD_DRIVERS)

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,9 @@ Once you have the Google Test Framework installed follow this alternative build
```
mkdir -p build/indi
cd build/indi
cmake -DINDI_BUILD_UNITTESTS=ON -DCMAKE_BUILD_TYPE=Debug ../../indi
cmake -DINDI_BUILD_UNITTESTS=ON -DCMAKE_BUILD_TYPE=Debug ../../
make
cd test
ctest -V
make test
```

For more details refer to the scripts in the travis-ci directory.
For more details refer to the scripts in the .circleci directory.
2 changes: 0 additions & 2 deletions integs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ INCLUDE_DIRECTORIES ( ${GTEST_INCLUDE_DIRS} )

include(GoogleTest)

ENABLE_TESTING()


MESSAGE (STATUS "INTEG:GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}")
MESSAGE (STATUS "INTEG:GTEST_LIBRARIES ${GTEST_LIBRARIES}")
Expand Down
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ MESSAGE (STATUS "GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}")
MESSAGE (STATUS "GMOCK_LIBRARIES ${GMOCK_LIBRARIES}")
MESSAGE (STATUS "GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}")

ENABLE_TESTING()

INCLUDE_DIRECTORIES ( ${GTEST_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES ( ${GMOCK_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR} )
Expand Down

0 comments on commit 3a646f2

Please sign in to comment.