Fix: Consistent Usage of target_link_libraries for CUDA Targets#646
Merged
NoureldinYosri merged 2 commits intoJan 26, 2024
Merged
Conversation
Otherwise this could lead to the following problem when building with CUDA:
```
CMake Error at pybind_interface/cuda/CMakeLists.txt:30 (target_link_libraries):
The plain signature for target_link_libraries has already been used with
the target "qsim_cuda". All uses of target_link_libraries with a target
must be either all-keyword or all-plain.
The uses of the plain signature are here:
* /usr/share/cmake-3.16/Modules/FindCUDA.cmake:1836 (target_link_libraries)
```
fa89c1d to
d0fa7a9
Compare
target_link_libraries for CUDA Targets
basnijholt
added a commit
to basnijholt/qsimcirq-feedstock
that referenced
this pull request
Dec 7, 2023
5 tasks
basnijholt
added a commit
to basnijholt/qsimcirq-feedstock
that referenced
this pull request
Dec 7, 2023
Contributor
Author
|
@NoureldinYosri note that the CUDA build is currently broken and these changes are required to make it work. |
NoureldinYosri
approved these changes
Jan 26, 2024
basnijholt
added a commit
to basnijholt/qsimcirq-feedstock
that referenced
this pull request
Jan 30, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request addresses a build configuration issue that arises (introduced in #643) when mixing plain and keyword signatures of
target_link_librariesin CMake for theqsim_cuda,qsim_custatevec,qsim_decidetargets. The existing setup led to a CMake error, as documented:Changes Made:
target_link_librariescommand for theqsim_cuda,qsim_custatevec,qsim_decidetargets to use the plain form. This change aligns with the internal usage oftarget_link_librarieswithin thecuda_add_librarymacro, ensuring consistency across the build configuration.Rationale:
CMake requires that all invocations of
target_link_librariesfor a specific target maintain a consistent usage pattern - either all using the plain form or all using the keyword form (such asPUBLICorPRIVATE). Thecuda_add_librarymacro used in this project employs the plain form oftarget_link_libraries, which necessitates a similar approach for additional invocations oftarget_link_librariesfor theqsim_cuda,qsim_custatevec,qsim_decidetargets.By aligning the usage pattern, this pull request resolves the build configuration error and maintains consistency in the CMake setup, ensuring a smoother build process.