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

CMakeified. #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
72 changes: 72 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (c) 2016 Alexander Lamaison
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

cmake_minimum_required(VERSION 3.0)

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.12.49.tar.gz"
SHA1 "bf7620ff95a5e6abfa6046154bbe7c1a85972d79"
)

project(BoostProcess VERSION 0.5)

include(CTest)

list(APPEND CMAKE_MODULE_PATH "${BoostProcess_SOURCE_DIR}/cmake")

set(include_install_dir "include")
set(config_install_dir "lib/cmake/${PROJECT_NAME}")

add_library(boost_process INTERFACE)

hunter_add_package(Boost COMPONENTS system filesystem iostreams)

find_package(Boost 1.48 CONFIG REQUIRED system filesystem iostreams)
target_link_libraries(boost_process INTERFACE
Boost::system
Boost::filesystem
Boost::iostreams)
target_include_directories(boost_process INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${include_install_dir}>)
if(WIN32)
target_compile_definitions(
boost_process INTERFACE _CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN)
endif()

add_subdirectory(libs)

set(config_export_name "${PROJECT_NAME}Config")
set(targets_export_name "${PROJECT_NAME}Targets")
set(project_config "${CMAKE_CURRENT_BINARY_DIR}/${config_export_name}.cmake")
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/${config_export_name}Version.cmake")
set(namespace "${PROJECT_NAME}::")

include(CMakePackageConfigHelpers)
configure_package_config_file( # Uses target_exports_name
"cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion)

install(
TARGETS boost_process
EXPORT "${targets_export_name}"
INCLUDES DESTINATION "${include_install_dir}")

install(
DIRECTORY "boost"
DESTINATION "${include_install_dir}")

install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}")
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}")
6 changes: 6 additions & 0 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@PACKAGE_INIT@

find_package(Boost CONFIG COMPONENTS system filesystem iostreams)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")
Loading