Skip to content
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

Avoid evaluating CMake LINK_LANGUAGE generator expressions in CMake <3.18 #667

Open
wants to merge 1 commit into
base: release-staging/rocm-rel-6.4
Choose a base branch
from

Conversation

umfranzw
Copy link
Collaborator

Avoid evaluating CMake LINK_LANGUAGE generator expressions in CMake <3.18

Recently, we added CMake HIP Language support. That change introduced generator expressions that use the LINK_LANGUAGE keyword. This keyword is only supported in CMake 3.18+. The minimum CMake version we require is 3.16.

As a result, if you built with CMake 3.16 - 3.18, you'd get a build failure.

This change adds checks around all the spots where the LINK_LANGUAGE keyword is used to avoid this problem.

It also adds a description of the CMake HIP Language support to the changelog (previously overlooked).

Copy link
Contributor

@spolifroni-amd spolifroni-amd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving a rewrite for the changelog. The item that I changed should also be moved to the "Changed" section.

CHANGELOG.md Outdated
@@ -21,6 +21,7 @@ Full documentation for rocPRIM is available at [https://rocm.docs.amd.com/projec
* Added the parallel `search` and `find_end` device functions similar to `std::search` and `std::find_end`, these functions search for the first and last occurrence of the sequence respectively.
* Added a parallel device-level function, `rocprim::search_n`, similar to the C++ Standard Library `std::search_n` algorithm.
* Added new constructors and a `base` function, and added `constexpr` specifier to all functions in `rocprim::reverse_iterator` to improve parity with the C++17 `std::reverse_iterator`.
* If you are using CMake 3.18+, you can now build using CMake HIP language support. This allows CMake to treat HIP as any other language (like C or CXX), removing the need to set the CXX environment variable. Instead, CMake attempts to find your HIP-aware compiler on its own. To build in this way, please set the USE\_HIPCXX option to ON (-DUSE\_HIPCXX=ON) when invoking CMake.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the "Changed" section.

Suggested change
* If you are using CMake 3.18+, you can now build using CMake HIP language support. This allows CMake to treat HIP as any other language (like C or CXX), removing the need to set the CXX environment variable. Instead, CMake attempts to find your HIP-aware compiler on its own. To build in this way, please set the USE\_HIPCXX option to ON (-DUSE\_HIPCXX=ON) when invoking CMake.
* You can use CMake HIP language support with CMake 3.18 and later. To use HIP language support, run `cmake` with `-DUSE_HIPCXX=ON` instead of setting the `CXX` variable to `HIP`.

Copy link
Collaborator Author

@umfranzw umfranzw Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've moved the bullet point to the "Changed" section and made the suggested change, which one small caveat: the CXX variable was previously set to the path to a HIP-aware compiler rather than HIP.

…3.18

Recently, we added CMake HIP Language support. That change introduced generator expressions
that use the LINK_LANGUAGE keyword. This keyword is only supported in CMake 3.18+.
The minimum CMake version we require is 3.16.

As a result, if you built with CMake 3.16 - 3.18, you'd get a build failure.

This change adds checks around all the spots where the LINK_LANGUAGE keyword is used
to avoid this problem.

It also adds a description of the CMake HIP Language support to the changelog (previously overlooked).
@umfranzw umfranzw force-pushed the fix_cmake_link_language_rebased branch from 10d475c to 6903b30 Compare January 6, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants