-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will also generate a BoostConfig.cmake file ready to be used by "find_package(Boost CONFIG)".
- Loading branch information
Showing
13 changed files
with
90 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set(_boost_deps @BOOST_FIND_PACKAGE@) | ||
|
||
foreach(dep ${_boost_deps}) | ||
find_package(${dep} QUIET) | ||
if(${dep}_FOUND) | ||
list(APPEND _boost_deps_found ${dep}) | ||
else() | ||
list(APPEND _boost_deps_missing ${dep}) | ||
endif() | ||
endforeach() | ||
|
||
message(STATUS "Boost dependencies found: ${_boost_deps_found}") | ||
if(_boost_deps_missing) | ||
message(STATUS "Boost dependencies missing: ${_boost_deps_missing}") | ||
endif() | ||
|
||
unset(_boost_deps) | ||
unset(_boost_deps_found) | ||
unset(_boost_deps_missing) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/BoostTargets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
include(CMakePackageConfigHelpers) | ||
write_basic_package_Version_file("BoostConfigVersion.cmake" | ||
VERSION ${BOOST_VERSION} | ||
COMPATIBILITY AnyNewerVersion) | ||
|
||
get_property(BOOST_FIND_PACKAGE GLOBAL PROPERTY Boost_Find_Package) | ||
if(BOOST_FIND_PACKAGE) | ||
# The list may be empty | ||
list(REMOVE_DUPLICATES BOOST_FIND_PACKAGE) | ||
endif() | ||
configure_file("BoostConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/BoostConfig.cmake" @ONLY) | ||
|
||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/BoostConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/BoostConfigVersion.cmake" | ||
DESTINATION lib/cmake/Boost | ||
) | ||
install(DIRECTORY ${BOOST_SOURCE}/boost | ||
DESTINATION include | ||
) | ||
install(EXPORT boost-libs | ||
DESTINATION lib/cmake/Boost | ||
NAMESPACE Boost:: | ||
FILE BoostTargets.cmake | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
# Define the header-only Boost target | ||
add_library(Boost::boost INTERFACE IMPORTED GLOBAL) | ||
add_library(Boost_boost INTERFACE) | ||
add_library(Boost::boost ALIAS Boost_boost) | ||
set_target_properties(Boost_boost PROPERTIES | ||
EXPORT_NAME "boost" | ||
) | ||
|
||
if(CMAKE_GENERATOR MATCHES "Xcode") | ||
# The CMake Xcode generator doesn't support system headers directly | ||
set_target_properties(Boost::boost PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem;${BOOST_SOURCE}" ) | ||
set_target_properties(Boost_boost PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem;${BOOST_SOURCE}" ) | ||
else() | ||
set_target_properties(Boost::boost PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${BOOST_SOURCE} ) | ||
set_target_properties(Boost::boost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${BOOST_SOURCE}) | ||
set_target_properties(Boost_boost PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${BOOST_SOURCE} ) | ||
set_target_properties(Boost_boost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${BOOST_SOURCE}>;$<INSTALL_INTERFACE:include>") | ||
endif() | ||
install(TARGETS Boost_boost DESTINATION lib EXPORT boost-libs) | ||
|
||
# Disable autolink | ||
set_property(TARGET Boost::boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ALL_NO_LIB=1) | ||
set_property(TARGET Boost_boost APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS BOOST_ALL_NO_LIB=1) | ||
|
||
add_library(Boost::boost_imported INTERFACE IMPORTED) | ||
set_target_properties(Boost::boost_imported PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${BOOST_SOURCE}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.8.0) | ||
project(import_test) | ||
|
||
find_package(Boost CONFIG COMPONENTS unit_test_framework) | ||
|
||
add_executable(import_test main.cpp) | ||
target_link_libraries(import_test PRIVATE Boost::unit_test_framework Boost::iostreams) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int main(int argc, char* argv[]) { | ||
return 0; | ||
} |