diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CmakeModule.cpp | 64 |
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()) |