aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-02-20 15:02:34 -0700
committerOndřej Čertík <ondrej@certik.us>2020-02-20 15:22:06 -0700
commit79b29a17c50d27bb089747a0b1ac23cf62db24c2 (patch)
tree4300461b8cf745cc6dfd2fd31f2418344aac96b8
parent21020c2f60a2a0f07bc4ef2506004ed5a361793b (diff)
downloadfpm-79b29a17c50d27bb089747a0b1ac23cf62db24c2.tar.gz
fpm-79b29a17c50d27bb089747a0b1ac23cf62db24c2.zip
Reuse the FC env variable if present
-rw-r--r--src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index be71598..b3195c7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,7 @@
use structopt::StructOpt;
use toml::Value;
use std::path::{Path, PathBuf};
+use std::env;
#[derive(Debug, StructOpt)]
struct Cli {
@@ -67,10 +68,16 @@ add_executable(p1 ../main.f90 {})
};
args.extend(vec!["-B", "build", "."]);
println!("[+] cmake {:?}", args);
+ let env_fc = env::var("FC");
+ let fc : String = if env_fc.is_err() {
+ "gfortran".to_string()
+ } else {
+ env_fc.unwrap()
+ };
let output = std::process::Command::new("cmake")
.args(&args)
.current_dir(target_dir)
- .env("FC", "gfortran")
+ .env("FC", fc)
.output().unwrap();
println!("status: {}", output.status);
println!("stdout: {}", String::from_utf8_lossy(&output.stdout));