diff --git a/CMake/HippoMocksConfig.cmake.in b/CMake/HippoMocksConfig.cmake.in new file mode 100644 index 0000000..4686859 --- /dev/null +++ b/CMake/HippoMocksConfig.cmake.in @@ -0,0 +1,7 @@ +@PACKAGE_INIT@ + +if(NOT TARGET HippoMocks::HippoMocks) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + + include(${CMAKE_CURRENT_LIST_DIR}/HippoMocksTargets.cmake) +endif() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index c0f44f5..8e37f84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,5 +6,32 @@ project(HippoMocks) add_subdirectory(HippoMocks) add_subdirectory(HippoMocksTest) -install(FILES ${PROJECT_SOURCE_DIR}/HippoMocks/hippomocks.h +install(FILES ${PROJECT_SOURCE_DIR}/SingleInclude/hippomocks.h DESTINATION include/) + +include(CMakePackageConfigHelpers) + +set(HIPPOMOCKS_CMAKE_CONFIG_DESTINATION "cmake/") + +configure_package_config_file( + ${CMAKE_CURRENT_LIST_DIR}/CMake/HippoMocksConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/HippoMocksConfig.cmake + INSTALL_DESTINATION + ${HIPPOMOCKS_CMAKE_CONFIG_DESTINATION} +) + +install( + EXPORT + HippoMocksTargets + NAMESPACE + HippoMocks:: + DESTINATION + ${HIPPOMOCKS_CMAKE_CONFIG_DESTINATION} +) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/HippoMocksConfig.cmake" + DESTINATION + ${HIPPOMOCKS_CMAKE_CONFIG_DESTINATION} +) diff --git a/HippoMocks/CMakeLists.txt b/HippoMocks/CMakeLists.txt index 6feadee..73dd9f4 100644 --- a/HippoMocks/CMakeLists.txt +++ b/HippoMocks/CMakeLists.txt @@ -1,6 +1,6 @@ add_library(HippoMocks INTERFACE) -target_include_directories(HippoMocks INTERFACE .) +target_include_directories(HippoMocks INTERFACE $ $) if (NOT WIN32) target_compile_options(HippoMocks INTERFACE @@ -8,5 +8,11 @@ if (NOT WIN32) ) endif() - - +install( + TARGETS + HippoMocks + EXPORT + HippoMocksTargets + DESTINATION + ./ +)