Unverified Commit 08de0904 authored by Mathieu Stefani's avatar Mathieu Stefani Committed by GitHub

Merge pull request #192 from tropf/master

make more friendly to embed in cmake projects
parents 4bfc4f81 197123b3
......@@ -2,6 +2,10 @@ cmake_minimum_required (VERSION 3.0.2)
project (pistache)
include(CheckCXXCompilerFlag)
option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
option(PISTACHE_BUILD_EXAMPLES "build examples alongside the project" OFF)
option(PISTACHE_INSTALL "add pistache as install target (recommended)" ON)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
......@@ -17,15 +21,19 @@ add_subdirectory (src)
include_directories (src)
add_subdirectory (examples)
if (PISTACHE_BUILD_EXAMPLES)
add_subdirectory (examples)
endif()
find_package(GTest)
if (GTEST_FOUND)
if (PISTACHE_BUILD_TESTS)
find_package(GTest)
if (GTEST_FOUND)
include_directories(${GTEST_INCLUDE_DIRS})
else()
else()
ADD_SUBDIRECTORY (googletest-release-1.7.0)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
endif()
endif()
enable_testing()
add_subdirectory(tests)
enable_testing()
add_subdirectory(tests)
endif()
......@@ -28,7 +28,8 @@ set(bin_install_dir "bin/")
target_link_libraries(pistache pthread)
install(
if (PISTACHE_INSTALL)
install(
TARGETS pistache
EXPORT ${targets_export_name}
ARCHIVE DESTINATION ${lib_install_dir}
......@@ -36,27 +37,28 @@ install(
RUNTIME DESTINATION ${bin_install_dir}
INCLUDES DESTINATION ${include_install_dir})
install(
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/pistache"
DESTINATION ${include_install_dir}
FILES_MATCHING PATTERN "*.*h")
install(TARGETS pistache
install(TARGETS pistache
EXPORT PistacheTargets
DESTINATION lib)
install(EXPORT PistacheTargets
install(EXPORT PistacheTargets
DESTINATION "lib/cmake/pistache"
EXPORT_LINK_INTERFACE_LIBRARIES
COMPONENT cmake-config
)
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
include(CMakePackageConfigHelpers)
configure_package_config_file(
"PistacheConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/PistacheConfig.cmake"
INSTALL_DESTINATION "lib/cmake/pistache"
)
install(
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/PistacheConfig.cmake"
DESTINATION "lib/cmake/pistache"
COMPONENT cmake-config
)
)
endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment