aboutsummaryrefslogtreecommitdiff
path: root/src/GlobalLib.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-10 15:22:45 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-10 15:23:46 +0100
commit87c378c20c30c9251c3787f6fd5496b72511f344 (patch)
treea991bcf9cdbbae6893de066ea7794030708a3af1 /src/GlobalLib.cpp
parent2de986c6415478abae0fd63f4724ea506c27a15a (diff)
Do not build dependency as library if it's header only library
Diffstat (limited to 'src/GlobalLib.cpp')
-rw-r--r--src/GlobalLib.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index 44652b8..cbd822e 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -124,21 +124,28 @@ namespace sibs
}
});
- // TODO: Create build path if it doesn't exist
- string debugBuildPath = packageDir + "/build/debug";
- Result<bool> buildFileResult = ninja.createBuildFile(sibsConfig.getPackageName(), sibsConfig.getDependencies(), debugBuildPath.c_str(), linkerFlagCallbackFunc);
- if(buildFileResult.isErr())
- return Result<string>::Err(buildFileResult.getErrMsg());
-
- Result<bool> buildResult = ninja.build(debugBuildPath.c_str());
- if(buildResult.isErr())
- return Result<string>::Err(buildResult.getErrMsg());
-
- string staticLibPath = debugBuildPath;
- staticLibPath += "/lib";
- staticLibPath += name;
- staticLibPath += ".a";
- linkerFlagCallbackFunc(staticLibPath);
- return Result<string>::Ok(staticLibPath);
+ if(ninja.getSourceFiles().empty())
+ {
+ return Result<string>::Ok("");
+ }
+ else
+ {
+ // TODO: Create build path if it doesn't exist
+ string debugBuildPath = packageDir + "/build/debug";
+ Result<bool> buildFileResult = ninja.createBuildFile(sibsConfig.getPackageName(), sibsConfig.getDependencies(), debugBuildPath.c_str(), linkerFlagCallbackFunc);
+ if (buildFileResult.isErr())
+ return Result<string>::Err(buildFileResult.getErrMsg());
+
+ Result<bool> buildResult = ninja.build(debugBuildPath.c_str());
+ if (buildResult.isErr())
+ return Result<string>::Err(buildResult.getErrMsg());
+
+ string staticLibPath = debugBuildPath;
+ staticLibPath += "/lib";
+ staticLibPath += name;
+ staticLibPath += ".a";
+ linkerFlagCallbackFunc(staticLibPath);
+ return Result<string>::Ok(staticLibPath);
+ }
}
} \ No newline at end of file