Skip to content

[cmake] globalize Boost targets imported by TA only #386

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

Merged
Merged
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
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Both methods are supported. However, for most users we _strongly_ recommend to b
- Boost.Container: header-only
- Boost.Test: header-only or (optionally) as a compiled library, *only used for unit testing*
- Boost.Range: header-only, *only used for unit testing*
- [BTAS](http://github.com/ValeevGroup/BTAS), tag fba66ad9881ab29ea8df49ac6a6006cab3fb3ce5 . If usable BTAS installation is not found, TiledArray will download and compile
- [BTAS](http://github.com/ValeevGroup/BTAS), tag 2917aa21465a93ae6f399874f247b5fe31d6b693 . If usable BTAS installation is not found, TiledArray will download and compile
BTAS from source. *This is the recommended way to compile BTAS for all users*.
- [MADNESS](https://github.com/m-a-d-n-e-s-s/madness), tag 0b44ef319643cb9721fbe17d294987c146e6460e .
Only the MADworld runtime and BLAS/LAPACK C API component of MADNESS is used by TiledArray.
Expand Down
12 changes: 11 additions & 1 deletion cmake/modules/FindOrFetchBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ endif()

# try find_package
if (NOT TARGET Boost::boost)

# detect which Boost targets I already have
foreach(tgt boost;headers;${Boost_BTAS_DEPS_LIBRARIES})
if (TARGET Boost::${tgt})
set(ta_imported_boost_${tgt} 0)
else()
set(ta_imported_boost_${tgt} 1)
endif()
endforeach()

include(FindPackageRegimport)
find_package_regimport(Boost ${TA_TRACKED_BOOST_VERSION} QUIET)
if (TARGET Boost::boost)
Expand All @@ -14,7 +24,7 @@ if (NOT TARGET Boost::boost)
# Boost::* targets by default are not GLOBAL, so to allow users of TA to safely use them we need to make them global
# more discussion here: https://gitlab.kitware.com/cmake/cmake/-/issues/17256
foreach(tgt boost;headers;${Boost_BTAS_DEPS_LIBRARIES})
if (TARGET Boost::${tgt})
if (TARGET Boost::${tgt} AND ta_imported_boost_${tgt})
get_target_property(_boost_tgt_${tgt}_is_imported_global Boost::${tgt} IMPORTED_GLOBAL)
if (NOT _boost_tgt_${tgt}_is_imported_global)
set_target_properties(Boost::${tgt} PROPERTIES IMPORTED_GLOBAL TRUE)
Expand Down
2 changes: 0 additions & 2 deletions external/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions external/versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ set(TA_TRACKED_MADNESS_PREVIOUS_TAG 29a2bf3d3c2670c608b7bfdf2299d76fbc20e041)
set(TA_TRACKED_MADNESS_VERSION 0.10.1)
set(TA_TRACKED_MADNESS_PREVIOUS_VERSION 0.10.1)

set(TA_TRACKED_BTAS_TAG fba66ad9881ab29ea8df49ac6a6006cab3fb3ce5)
set(TA_TRACKED_BTAS_PREVIOUS_TAG f7c9385348ea87202a887504e2be8bc477efdc3f)
set(TA_TRACKED_BTAS_TAG 2917aa21465a93ae6f399874f247b5fe31d6b693)
set(TA_TRACKED_BTAS_PREVIOUS_TAG fba66ad9881ab29ea8df49ac6a6006cab3fb3ce5)

set(TA_TRACKED_LIBRETT_TAG 68abe31a9ec6fd2fd9ffbcd874daa80457f947da)
set(TA_TRACKED_LIBRETT_PREVIOUS_TAG 7e27ac766a9038df6aa05613784a54a036c4b796)
Expand Down