Skip to content

Commit

Permalink
Add CMake option BUILD_TESTS (#333)
Browse files Browse the repository at this point in the history
Add an option BUILD_TESTS to decide whether to build S2 unit tests.

Default is with tests.
  • Loading branch information
acelyc111 authored Nov 22, 2023
1 parent 30f7072 commit fadf458
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ add_feature_info(SHARED_LIBS BUILD_SHARED_LIBS
"builds shared libraries instead of static.")

option(BUILD_EXAMPLES "Build s2 documentation examples." ON)
option(BUILD_TESTS "Build s2 unittests." ON)

option(WITH_PYTHON "Add python interface" OFF)
add_feature_info(PYTHON WITH_PYTHON "provides python interface to S2")
Expand Down Expand Up @@ -431,8 +432,12 @@ install(TARGETS ${S2_TARGETS}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")

message("GOOGLETEST_ROOT: ${GOOGLETEST_ROOT}")
if (GOOGLETEST_ROOT)
if (BUILD_TESTS)
if (NOT GOOGLETEST_ROOT)
message(FATAL_ERROR "BUILD_TESTS requires GOOGLETEST_ROOT")
endif()
message("GOOGLETEST_ROOT: ${GOOGLETEST_ROOT}")

add_subdirectory(${GOOGLETEST_ROOT}/googlemock build_gmock)
include_directories(${GOOGLETEST_ROOT}/googlemock/include)
include_directories(${GOOGLETEST_ROOT}/googletest/include)
Expand Down

0 comments on commit fadf458

Please sign in to comment.