aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-03 18:34:29 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-03 18:36:13 +0100
commit46257ab7cf017f0f35a2025257ad5f45a9e985f0 (patch)
tree99000f35d7319b76d99acf700aa558496cf2dcf6 /src
parentfb18bd235bc716963c72c1dd6358176cb50516ae (diff)
CMake: Add all generated library files as dependency instead of the last
modified one
Diffstat (limited to 'src')
-rw-r--r--src/CmakeModule.cpp64
1 files changed, 24 insertions, 40 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp
index e05a65f..7d5509c 100644
--- a/src/CmakeModule.cpp
+++ b/src/CmakeModule.cpp
@@ -133,55 +133,39 @@ namespace sibs
if(config.getPackageType() != PackageType::EXECUTABLE)
{
- FileString libFile;
- u64 libFileLastModified = 0;
-
string buildPathUtf8 = toUtf8(buildPath);
- nprintf("Searching for library generate by cmake in build path: %s\n", buildPathUtf8.c_str());
- walkDirFiles(buildPath.c_str(), [&libFile, &libFileLastModified](tinydir_file *file)
+ nprintf("Searching for libraries generate by cmake in build path: %s\n", buildPathUtf8.c_str());
+ walkDirFiles(buildPath.c_str(),
+ [&config, &staticLinkerFlagCallbackFunc, &dynamicLinkerFlagCallbackFunc](tinydir_file *file)
{
if(_tinydir_strcmp(file->extension, CONFIG_DYNAMIC_LIB_FILE_EXTENSION) == 0)
{
- u32 fileLastModified = getFileLastModifiedTime(file->path);
- if(fileLastModified > libFileLastModified)
+ string libFileUtf8 = toUtf8(file->path);
+ nprintf("Library generated by cmake: %s\n", libFileUtf8.c_str());
+
+ switch(config.getPackageType())
{
- libFileLastModified = fileLastModified;
- libFile = file->path;
+ case PackageType::STATIC:
+ {
+ string libFileCmd = "\"";
+ libFileCmd += libFileUtf8;
+ libFileCmd += "\"";
+ staticLinkerFlagCallbackFunc(libFileCmd);
+ break;
+ }
+ case PackageType::DYNAMIC:
+ case PackageType::LIBRARY:
+ {
+ string libFileCmd = "\"";
+ libFileCmd += libFileUtf8;
+ libFileCmd += "\"";
+ dynamicLinkerFlagCallbackFunc(libFileCmd);
+ break;
+ }
}
}
});
- if(libFileLastModified == 0)
- {
- string errMsg = "Package ";
- errMsg += config.getPackageName();
- errMsg += " was built using cmake but no generated library was found";
- return Result<bool>::Err(errMsg);
- }
- string libFileUtf8 = toUtf8(libFile);
- nprintf("Library generated by cmake: %s\n", libFileUtf8.c_str());
-
- switch(config.getPackageType())
- {
- case PackageType::STATIC:
- {
- string libFileCmd = "\"";
- libFileCmd += libFileUtf8;
- libFileCmd += "\"";
- staticLinkerFlagCallbackFunc(libFileCmd);
- break;
- }
- case PackageType::DYNAMIC:
- case PackageType::LIBRARY:
- {
- string libFileCmd = "\"";
- libFileCmd += libFileUtf8;
- libFileCmd += "\"";
- dynamicLinkerFlagCallbackFunc(libFileCmd);
- break;
- }
- }
-
// TODO: Clean this up. The below code is indentical to code in Ninja.cpp.......
string projectPathUtf8 = toUtf8(config.getProjectPath());
for (const string &globalIncludeDir : config.getGlobalIncludeDirs())