aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-01-12 15:28:03 -0700
committerOndřej Čertík <ondrej@certik.us>2020-01-12 15:41:08 -0700
commit4d37d611be6d009c2f6d6e95fc6b12d134285fa6 (patch)
tree5095f14cbd9bd1312616b53c37b33608ca7d5c3d /src
parentee89a3e3dfeae3881065a81646c43d8ac07824a5 (diff)
downloadfpm-4d37d611be6d009c2f6d6e95fc6b12d134285fa6.tar.gz
fpm-4d37d611be6d009c2f6d6e95fc6b12d134285fa6.zip
Use a template
Diffstat (limited to 'src')
-rw-r--r--src/main.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index ddcb335..9252c56 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -26,24 +26,25 @@ fn collect_source_files() -> Vec<std::path::PathBuf> {
fn build() {
let files = collect_source_files();
+ let mut files2: String = String::new();
for file in &files {
println!("File: {}", file.to_str().unwrap());
+ if !file.to_str().unwrap().ends_with("main.f90") {
+ let s1:String = files2.to_string();
+ let s2:String = file.to_str().unwrap().to_string();
+ files2 = s1 + " " + &s2;
+ }
}
println!("Files: {:?}", files);
- let s = "\
+ let s = format!("\
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
enable_language(Fortran)
project(p1)
-set(SRC
- a.f90
- b.f90
-)
-
-add_executable(p1 main.f90 ${SRC})
-";
+add_executable(p1 main.f90 {})
+", files2);
std::fs::write("CMakeLists.txt", s).unwrap();
let output = std::process::Command::new("cmake")
.args(&["-B", "build", "."])