wjakob / tbb

Intel TBB with CMake build system
Apache License 2.0
369 stars 161 forks source link

Export config for shared TBB. #57

Closed Nekto89 closed 4 years ago

Nekto89 commented 5 years ago

This allows usage of "find_package(TBB)"

wjakob commented 5 years ago

This looks really nice -- just one question (I have never used this approach): can you take a look at the other commit #37 and let me know what the difference is? I'm planning to merge one of the two but am not familiar enough with this usage of Cmake. Thanks!

Nekto89 commented 5 years ago

37 doesn't export non-static TBB and I've completely ignored static configuration.

I don't know who will need to install both static and dynamic configurations in one package.

It's probably better to have same imported target names as in official package (TBB::tbb, TBB::tbbmalloc, TBB::tbbmalloc_proxy).

Additional config file in #37 will be more flexible because it will allow to add more information there in future (for example, TBB_INTERFACE_VERSION like in official TBBConfig.cmake).

jschueller commented 4 years ago

hi @wjakob can you merge this one ?

EricBackus commented 4 years ago

I too would really like to do "find_package(tbb)" and have it work. I assume this pull request would achieve that, is there any plan to merge this in the near future?

jschueller commented 4 years ago

It's up to @wjakob, please answer.

Nekto89 commented 4 years ago

@wjakob should I change something?

wjakob commented 4 years ago

Sorry about the big delay, I am maintaining many open source projects and my time for each one is quite limited. I am just going to merge this PR for now since it targets the shared exports, and that generally seem more useful to me. @tschw, if you are still interested in adding CMake exports for the static targets, can you adjust your pr #37 on top of this?

jschueller commented 4 years ago

@wjakob maybe you could grant me write access so to avoid these delays

EricBackus commented 4 years ago

I can confirm that find_package(TBB) works for me now. It creates a TBB::tbb library I can link to successfully. Thanks everyone for making this available!

However, I don't see version support, so find_package(TBB 2019) doesn't work. This is less important, but still might be nice. I'm no expert, but I think fix might be something like:

set(cmake_config_version_file "${CMAKE_CURRENT_BINARY_DIR}/TBBConfigVersion.cmake")
set(cmake_destination_directory "${CMAKE_INSTALL_LIBDIR}/cmake/tbb")
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${cmake_config_version_file}" COMPATIBILITY AnyNewerVersion)
install(FILES "${cmake_config_version_file}" DESTINATION "${make_destination_directory}")
jschueller commented 4 years ago

see #68

EricBackus commented 4 years ago

see #68

Ooooh. Thanks! That was fast!