summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorDakota Hawkins <dakotahawkins@gmail.com>2018-07-24 15:06:55 (GMT)
committerDakota Hawkins <dakotahawkins@gmail.com>2018-08-21 17:02:09 (GMT)
commit759ef7c4e9662321548d1c30528c78ecdba2a05d (patch)
tree8123065767fdd8d9241804f032632573a2522bba /googlemock
parentb88511ef640c046ec9c7553b383a2aba64c80967 (diff)
downloadgoogletest-759ef7c4e9662321548d1c30528c78ecdba2a05d.zip
googletest-759ef7c4e9662321548d1c30528c78ecdba2a05d.tar.gz
googletest-759ef7c4e9662321548d1c30528c78ecdba2a05d.tar.bz2
Improve CMake exported targets.refs/pull/1682/head
I _think_ this represents some of the "best practices" for exporting targets. They'll be available in a `googletest::` namespace (e.g. `googletest::gmock`) with non-namespaced `ALIAS` targets. - Added GOOGLETEST_VERSION variable - Use `CMakePackageConfigHelpers`, bump minimum CMake version to 2.8.8 Signed-off-by: Dakota Hawkins <dakotahawkins@gmail.com>
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/CMakeLists.txt39
1 files changed, 33 insertions, 6 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index 07b6ad2..1db14a2 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -37,7 +37,7 @@ if (CMAKE_VERSION VERSION_LESS 3.0)
project(gmock CXX C)
else()
cmake_policy(SET CMP0048 NEW)
- project(gmock VERSION 1.9.0 LANGUAGES CXX C)
+ project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
endif()
cmake_minimum_required(VERSION 2.6.4)
@@ -120,18 +120,45 @@ endif()
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
- target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
- target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
+ target_include_directories(gmock SYSTEM
+ INTERFACE
+ $<BUILD_INTERFACE:${gmock_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${gmock_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${gtest_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${gtest_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>)
+ target_include_directories(gmock_main SYSTEM
+ INTERFACE
+ $<BUILD_INTERFACE:${gmock_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${gmock_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${gtest_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${gtest_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>)
endif()
########################################################################
#
# Install rules
if(INSTALL_GMOCK)
- install(TARGETS gmock gmock_main
+ install(TARGETS gmock
+ EXPORT gmockConfigInternal
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(EXPORT gmockConfigInternal
+ DESTINATION "${INSTALL_CMAKE_DIR}"
+ NAMESPACE googletest_)
+ install(TARGETS gmock_main
+ EXPORT gmock_mainConfigInternal
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ install(EXPORT gmock_mainConfigInternal
+ DESTINATION "${INSTALL_CMAKE_DIR}"
+ NAMESPACE googletest_)
+ set(googletest_install_targets
+ ${googletest_install_targets} gmock gmock_main PARENT_SCOPE)
+
install(DIRECTORY "${gmock_SOURCE_DIR}/include/gmock"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")