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

Bill Hoffman bill.hoffman at kitware.com
Tue Oct 9 12:20:34 EDT 2007


Sylvain Benner wrote:
>
>> 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
This has to be this way, or the cmake generated projects will not be 
able to find
libraries in other projects of the same build type.  Can someone explain 
the issue
with this?   We are using this for VTK and several other larger 
projects, and
it works fine.

-Bill



More information about the CMake mailing list