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..710ae60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,5 +6,29 @@ project(HippoMocks) add_subdirectory(HippoMocks) add_subdirectory(HippoMocksTest) -install(FILES ${PROJECT_SOURCE_DIR}/HippoMocks/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..eff7fd8 100644 --- a/HippoMocks/CMakeLists.txt +++ b/HippoMocks/CMakeLists.txt @@ -1,12 +1,19 @@ add_library(HippoMocks INTERFACE) -target_include_directories(HippoMocks INTERFACE .) -if (NOT WIN32) - target_compile_options(HippoMocks - INTERFACE - -Wall -Wextra -pedantic -Wno-long-long -std=c++11 - ) -endif() +target_include_directories(HippoMocks INTERFACE $ $) +target_compile_features(HippoMocks INTERFACE cxx_std_11) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hippomocks.h + DESTINATION include/) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/detail + DESTINATION include) +install( + TARGETS + HippoMocks + EXPORT + HippoMocksTargets + DESTINATION + ./ +) diff --git a/HippoMocksTest/CMakeLists.txt b/HippoMocksTest/CMakeLists.txt index 1e9e9b0..0884d65 100644 --- a/HippoMocksTest/CMakeLists.txt +++ b/HippoMocksTest/CMakeLists.txt @@ -37,6 +37,14 @@ set(SOURCES add_executable(HippoMocksTest64 ${SOURCES} ) + +if (NOT WIN32) + target_compile_options(HippoMocksTest64 + PRIVATE + -Wall -Wextra -pedantic -Wno-long-long + ) +endif() + target_link_libraries(HippoMocksTest64 PRIVATE HippoMocks