Closed petrhosek closed 2 years ago
Hi @petrhosek!
Thank you for your pull request and welcome to our community.
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed
. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
Thank you for the review, would it be possible to merge this PR?
I don't have write access to the repo. @malfet PTAL
@Maratyszcza does the change look good to you? @petrhosek can you please share link to CMake doc explaining what namespace prefixes are and what version of cmake they got introduced
It's a common convention in modern CMake to provide aliases for each installed library to ensure that the library can be consumes via target_link(<pkg>::<target_name>)
both if the project is used via find_package(<pkg>)
or via add_subdirectory
.
See for example https://github.com/abseil/abseil-cpp/blob/d2c5297a3c3948de765100cb7e5cccca1210d23c/CMake/AbseilHelpers.cmake#L329. This can avoid similar constructs in downstream projects such as https://github.com/google/ruy/blob/368db7123bf3178c92c8502696c6865fb07bfcda/CMakeLists.txt#L85.
There's an ongoing discussion about how to supports this directly in CMake, see https://gitlab.kitware.com/cmake/cmake/-/issues/22687
Thank you for the explanation, looks good to me
cc @bjacob
This allows projects that depend on cpuinfo to use namespace qualified target name regardless of whether they consume cpuinfo through add_subdirectory or find_package.