Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 3, 2018, 1:43:20 AM (6 years ago)
Author:
landauf
Message:

with the latest CMake there are a lot of warnings about the usage of CMP0026. therefore the naming and content of the module/plugin-files had to be changed:
old: <library-filename>.module with content <target-name>
new: <target-name>.module with content <library-filename>
this seems to comply better with cmake and works equally well in c++ (with some small adjustments).
reference: https://cmake.org/cmake/help/v3.0/policy/CMP0026.html

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/ApplicationPaths.cc

    r11071 r11692  
    3232#include <cstdlib>
    3333#include <cstdio>
     34#include <fstream>
    3435#include <vector>
    3536#include <boost/filesystem.hpp>
     
    169170    }
    170171
    171     std::vector<std::string> ApplicationPaths::getModulePaths()
     172    std::map<std::string, std::string> ApplicationPaths::getModulePaths()
    172173    {
    173174        return this->getModuleOrPluginPaths(modulePath_, specialConfig::moduleExtension);
    174175    }
    175176
    176     std::vector<std::string> ApplicationPaths::getPluginPaths()
     177    std::map<std::string, std::string> ApplicationPaths::getPluginPaths()
    177178    {
    178179        return this->getModuleOrPluginPaths(pluginPath_, specialConfig::pluginExtension);
    179180    }
    180181
    181     std::vector<std::string> ApplicationPaths::getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension)
    182     {
    183         std::vector<std::string> paths;
     182    std::map<std::string, std::string> ApplicationPaths::getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension)
     183    {
     184        std::map<std::string, std::string> paths;
    184185
    185186        // We search for helper files with the following extension
     
    204205                {
    205206                    // We've found a helper file
    206                     const std::string& library = filename.substr(0, filename.size() - extensionlength);
    207                     paths.push_back(directory.BF_GENERIC_STRING() + '/' + library);
     207                    const std::string& moduleName = filename.substr(0, filename.size() - extensionlength);
     208
     209                    // Read it's content to get the library's name
     210                    std::ifstream infile(file->path().string().c_str());
     211                    std::string libraryName;
     212                    if (infile >> libraryName)
     213                    {
     214                        std::string libraryPath = directory.BF_GENERIC_STRING() + '/' + libraryName;
     215                        paths[moduleName] = libraryPath;
     216                    }
     217                    else
     218                    {
     219                        orxout(internal_warning) << "Could not file " << filename << endl;
     220                    }
    208221                }
    209222            }
Note: See TracChangeset for help on using the changeset viewer.