Skip to content

Per-language compiler flags#326

Merged
abouteiller merged 1 commit intoICLDisco:masterfrom
therault:per_compiler_option
Mar 3, 2022
Merged

Per-language compiler flags#326
abouteiller merged 1 commit intoICLDisco:masterfrom
therault:per_compiler_option

Conversation

@therault
Copy link
Copy Markdown
Contributor

@therault therault commented Mar 2, 2022

Use generator expressions to only apply compiler flags for the
language they have been tested with. Try all languages for each
flag, when it makes sense. Provide a new function to do so
in a convenient way.

Closes issue #295

@therault therault requested a review from bosilca as a code owner March 2, 2022 16:58
@abouteiller abouteiller added this to the v4.0 milestone Mar 2, 2022
@abouteiller abouteiller self-requested a review March 2, 2022 21:31
@abouteiller
Copy link
Copy Markdown
Contributor

Same changes need to be carried to DPLASMA

@abouteiller
Copy link
Copy Markdown
Contributor

abouteiller commented Mar 2, 2022

@therault you need to sign your commits
git config --global commit.gpgsign true
git rebase --exec 'git commit --amend --no-edit -n -S' -I master

language they have been tested with. Try all languages for each
flag, when it makes sense. Provide a new function to do so
in a convenient way.

Signed-off-by: Thomas Herault <herault@icl.utk.edu>
@therault therault force-pushed the per_compiler_option branch from b9b777a to a27be65 Compare March 2, 2022 23:15
@therault therault self-assigned this Mar 3, 2022
@abouteiller abouteiller merged commit cf200b4 into ICLDisco:master Mar 3, 2022
therault added a commit to therault/parsec that referenced this pull request Mar 8, 2022
There is a CMake language error in PR ICLDisco#326.
If the variable X is already defined (to TRUE or to FALSE or to anything) when calling
cmake_language(CALL "check_${Y}_compiler_flag" "-Wall" "X" ) for any Y, then the
test is skipped, and the variable remains unchanged.

As a result, the function check_and_set_compiler_option would take the flags of the C
compiler and apply them to all compilers, which was exactly what we wanted to avoid...

This PR fixes that by using a variable name different for each test (adding the
language as part of the language name), and uses the code of PR ICLDisco#336 to sanitize
the names of the variables/tests.

It also cleans up the messages, becoming slightly less verbose than before:
it lists the languages that support the flag (or says none) instead of showing
two lines per test.

This PR should supersede PR ICLDisco#336 if it is approved.
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.

3 participants