Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable testing from the top-level build directory #1889

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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