diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CmakeModule.cpp | 11 | ||||
-rw-r--r-- | src/main.cpp | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index eeb8a9c..3beb792 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -43,6 +43,7 @@ namespace sibs #endif string staticLinkerFlags; + auto parentProjStaticLinkerFlagCallbackFunc = staticLinkerFlagCallbackFunc; if (!staticLinkerFlagCallbackFunc || (config.getPackageType() == PackageType::DYNAMIC || config.getPackageType() == PackageType::LIBRARY)) { staticLinkerFlagCallbackFunc = [&staticLinkerFlags](const string &linkerFlag) @@ -53,6 +54,7 @@ namespace sibs } string dynamicLinkerFlags; + auto parentProjDynamicLinkerFlagCallbackFunc = dynamicLinkerFlagCallbackFunc; // TODO: If project contains no source files, then we shouldn't override this function... why? if(!dynamicLinkerFlagCallbackFunc || config.getPackageType() != PackageType::STATIC) { @@ -138,6 +140,7 @@ namespace sibs break; } } + //cmd += TINYDIR_STRING(" -DCMAKE_SKIP_RPATH=\"1\""); cmd += TINYDIR_STRING(" \"-B"); cmd += buildPath; cmd += TINYDIR_STRING("\" \"-H"); @@ -190,7 +193,7 @@ namespace sibs string buildPathUtf8 = toUtf8(buildPath); nprintf("Searching for libraries generate by cmake in build path: %s\n", buildPathUtf8.c_str()); walkDirFilesRecursive(buildPath.c_str(), - [&config, &staticLinkerFlagCallbackFunc, &dynamicLinkerFlagCallbackFunc](tinydir_file *file) + [&config, &parentProjStaticLinkerFlagCallbackFunc, &parentProjDynamicLinkerFlagCallbackFunc](tinydir_file *file) { if(_tinydir_strcmp(file->extension, CONFIG_DYNAMIC_LIB_FILE_EXTENSION) == 0 || _tinydir_strcmp(file->extension, CONFIG_STATIC_LIB_FILE_EXTENSION) == 0) { @@ -204,7 +207,8 @@ namespace sibs string libFileCmd = "\""; libFileCmd += libFileUtf8; libFileCmd += "\""; - staticLinkerFlagCallbackFunc(libFileCmd); + if(parentProjStaticLinkerFlagCallbackFunc) + parentProjStaticLinkerFlagCallbackFunc(libFileCmd); break; } case PackageType::DYNAMIC: @@ -213,7 +217,8 @@ namespace sibs string libFileCmd = "\""; libFileCmd += libFileUtf8; libFileCmd += "\""; - dynamicLinkerFlagCallbackFunc(libFileCmd); + if(parentProjDynamicLinkerFlagCallbackFunc) + parentProjDynamicLinkerFlagCallbackFunc(libFileCmd); break; } } diff --git a/src/main.cpp b/src/main.cpp index 910380a..24ef61f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -83,6 +83,8 @@ using namespace std::chrono; // TODO: Auto export all symbols under windows (https://stackoverflow.com/questions/225432/export-all-symbols-when-creating-a-dll) +// TODO: Fix issue where when you have a dependency on a cmake project with dynamic library, the dynamic library wont be found at runtime for whatever reason + #if OS_FAMILY == OS_FAMILY_POSIX #define ferr std::cerr #else |