Add standard ipo variant for CMakePackage#18374
Merged
alalazo merged 2 commits intospack:developfrom Oct 21, 2020
Merged
Conversation
adamjstewart
approved these changes
Aug 29, 2020
Member
adamjstewart
left a comment
There was a problem hiding this comment.
I'll wait for a couple other maintainers to review.
Member
For older versions of CMake, will the flag be ignored, or could it cause the build to crash? We could also check the version: if self.spec.satisfies('^cmake@3.9:'):
args.append(define('CMAKE_INTERPROCEDURAL_OPTIMIZATION', ipo)) |
Contributor
Author
I think it's just ignored, but it might spit out a warning that confuses users, so that's a good idea. We probably don't want to just ignore the user's variant if they have an incompatible version of CMake, too; let's add a conflict with CMake < 3.9. |
2410cae to
dc63b2d
Compare
junghans
approved these changes
Aug 29, 2020
* +ipo sets CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON * Conflict between +ipo and ^cmake@:3.8
dc63b2d to
c28a061
Compare
Member
|
Ping @alalazo |
junghans
approved these changes
Oct 19, 2020
alalazo
approved these changes
Oct 20, 2020
alalazo
reviewed
Oct 20, 2020
Member
|
Thanks @omor1 ! |
This was referenced Jul 16, 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.
Due to CMake's handling of compilers, linkers, archivers, etc., it can be harder to enable IPO/LTO by simply manipulating
CFLAGS,AR,RANLIB, etc. than in autotools-based projects. The variableCMAKE_INTERPROCEDURAL_OPTIMIZATIONhas existed since CMake 3.9 to allow compilation with IPO/LTO more easily.This PR adds a standard
ipovariant to CMake packages, defaulting toFalse, that allows users to control this variable. Enabling it possibly breaks some packages, but it defaults to off, so I don't think it should cause any problems.Closes #18373.