[CMake] How can I avoid the addition of Debug/Release to the link path?

Sylvain Benner benner at virtools.com
Tue Oct 9 12:05:50 EDT 2007


> I then generate Xcode projects, but they give me a warning that
> /path/to/Debug (or /path/to/Release) doesn't exist in the linker flag
> -L/path/to/{Debug,Release} (and fail because there are alongside
> libraries being pulled it). Apparently, cmake added the linker flag
> -L/path/to/Debug with the above macro, where I'd like it to add
> -L/path/to instead. Is there a way to do this? Perhaps with
> LINK_DIRECTORIES()?
>   

You're right, given the CMake code, the appended configuration name is 
hardcoded:

    std::string linkDirs;
    // add the library search paths
    for(std::vector<cmStdString>::const_iterator libDir = libDirs.begin();
        libDir != libDirs.end(); ++libDir)
      {
      if(libDir->size() && *libDir != "/usr/lib")
        {
        if(this->XcodeVersion > 15)
          {
          // now add the same one but append $(CONFIGURATION) to it:
          linkDirs += " ";
          linkDirs += this->XCodeEscapePath(libDir->c_str());
// line 1890 --------------------
          linkDirs += "/$(CONFIGURATION)";
// ------------------------------
          }
        linkDirs += " ";
        linkDirs += this->XCodeEscapePath(libDir->c_str());
        }
      }
    this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS",
                                      linkDirs.c_str(), configName);

I don't know why it is like this though, it's a bit weird.
I encourage you to fill a bug report on the bug tracker - 
http://www.cmake.org/Bug

--Sylvain




More information about the CMake mailing list