Skip to content

Commit

Permalink
Don't install gtest if building from source
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Taylor <paul.e.taylor@me.com>
  • Loading branch information
hcho3 and trxcllnt committed May 4, 2023
1 parent 2566b4d commit d160ee9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ foreach(lib ${TREELITE_TARGETS})
endforeach()

# Export install targets
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# Include CPack only if the current project is top level.
include(CPack)
endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(INSTALL_TARGETS ${TREELITE_TARGETS}
Expand Down
4 changes: 4 additions & 0 deletions cmake/ExternalLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ if(BUILD_CPP_TEST)
FetchContent_MakeAvailable(googletest)
add_library(GTest::GTest ALIAS gtest)
add_library(GTest::gmock ALIAS gmock)
if(IS_DIRECTORY "${googletest_SOURCE_DIR}")
# Do not install gtest
set_property(DIRECTORY ${googletest_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
endif()
endif()
endif()

0 comments on commit d160ee9

Please sign in to comment.