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

skip gtest install rules for newer gtest versions #857

Merged
merged 1 commit into from
Feb 17, 2017
Merged
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
12 changes: 12 additions & 0 deletions cmake/test/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,19 @@ if(NOT GTEST_FOUND)
get_filename_component(_CATKIN_GTEST_BASE_DIR ${_CATKIN_GTEST_SOURCE_DIR} PATH)
# add CMakeLists.txt from gtest dir
set(_CATKIN_GTEST_BINARY_DIR ${CMAKE_BINARY_DIR}/gtest)

# overwrite CMake install command to skip install rules for gtest targets
# which have been added in version 1.8.0
set(_CATKIN_SKIP_INSTALL_RULES TRUE)
function(install)
if(_CATKIN_SKIP_INSTALL_RULES)
return()
endif()
_install(${ARGN})
endfunction()
add_subdirectory(${_CATKIN_GTEST_BASE_DIR} ${_CATKIN_GTEST_BINARY_DIR})
set(_CATKIN_SKIP_INSTALL_RULES FALSE)

# mark gtest targets with EXCLUDE_FROM_ALL to only build when tests are built which depend on them
set_target_properties(gtest gtest_main PROPERTIES EXCLUDE_FROM_ALL 1)
get_filename_component(_CATKIN_GTEST_INCLUDE_DIR ${_CATKIN_GTEST_INCLUDE} PATH)
Expand Down