-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Environment: Fix passing envrionment variables CPPFLAGS and CFLAGS
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem here is actually rather simple, `dict.setdefault()` doesn't work like I thought it did, I thought it created a weak entry, but it actually is equivalent to: ```python if k not in dict: dict[k] = v ``` Instead we'll use an intermediate dictionary (a default dictionary actually, since that makes things a little cleaner) and then add the keys from that dict to self.options as applicable. Test case written by Jussi, Fix by Dylan Co-authored-by: Jussi Pakkanen Fixes: #8361 Fixes: #8345
- Loading branch information
Showing
6 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
project('multienv', 'c', 'cpp') | ||
|
||
executable('cexe', 'prog.c') | ||
executable('cppexe', 'prog.cpp') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include<stdio.h> | ||
|
||
#ifndef CPPFLAG | ||
#error CPPFLAG not set | ||
#endif | ||
|
||
#ifndef CFLAG | ||
#error CFLAGS not set | ||
#endif | ||
|
||
#ifdef CXXFLAG | ||
#error CXXFLAG is set | ||
#endif | ||
|
||
int main(int argc, char **argv) { | ||
printf("%d %s\n", argc, argv[0]); | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include<cstdio> | ||
|
||
#ifndef CPPFLAG | ||
#error CPPFLAG not set | ||
#endif | ||
|
||
#ifdef CFLAG | ||
#error CFLAG is set | ||
#endif | ||
|
||
#ifndef CXXFLAG | ||
#error CXXFLAG not set | ||
#endif | ||
|
||
int main(int argc, char **argv) { | ||
printf("%d %s\n", argc, argv[0]); | ||
return 0; | ||
} |