Created
May 16, 2016 22:02
-
-
Save xlab/05198ba4f7727b5d61ebfa16e821c87c to your computer and use it in GitHub Desktop.
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
func stealDefinesFromCC() (defs string, ok bool) { | |
cc, ok := os.LookupEnv("CC") | |
if !ok { // second chance for CPP | |
cc, ok = os.LookupEnv("CPP") | |
if !ok { | |
return | |
} | |
} | |
cmd := exec.Command(cc, "-dM", "-E", "-x", "c", "/dev/null") | |
buf, err := cmd.CombinedOutput() | |
if err != nil { | |
log.Println("[WARN]:", err) | |
return | |
} | |
defs = string(buf) | |
return defs, true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment