From 8215872be25a06640b2a126fdc9f66e11f9b518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:34:41 -0700 Subject: Construct the correct cmake call on Windows --- src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 59e4c81..35dde13 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,8 +44,17 @@ project(p1) add_executable(p1 main.f90 {}) ", files2); std::fs::write("CMakeLists.txt", s).unwrap(); + + let mut args: Vec<&str> = vec![]; + if cfg!(windows) { + args.extend(vec!["-G", "MinGW Makefiles", + "-DCMAKE_SH=CMAKE_SH-NOTFOUND"]) + }; + args.extend(vec!["-B", "build", "."]); + println!("[+] cmake {:?}", args); let output = std::process::Command::new("cmake") - .args(&["-B", "build", "."]) + .args(&args) + .env("FC", "gfortran") .output().unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); @@ -54,8 +63,11 @@ add_executable(p1 main.f90 {}) panic!("Command failed.") } + println!(""); + let args = vec!["--build", "build"]; + println!("[+] cmake {:?}", args); let output = std::process::Command::new("cmake") - .args(&["--build", "build"]) + .args(&args) .output().unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); -- cgit v1.2.3