Skip to content

Xcode: unwanted linker search paths cause warning

When generating an Xcode project, I see that for each -L linker path another one is added per ${CONFIGURATION}:

-L dependencies/curl/lib (which I added)

and

-L dependencies/curl/lib/Debug (which I haven't)

The latter path does not exist and generates this linker warning: ld: warning: directory not found for option '-L/Users/tamas/work/pms/build/dependencies/curl/lib/Debug'

I found this report from 2006 which describes the same problem: https://cmake.org/pipermail/cmake/2006-September/011238.html and wondered if there was an opt-out for this behavior since then.

I dug a little in the Xcode generator source and found this:

      for (auto const& libDir : cli->GetDirectories()) {
        if (!libDir.empty() && libDir != "/usr/lib") {
          libSearchPaths.Add(this->XCodeEscapePath(
            libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
          libSearchPaths.Add(this->XCodeEscapePath(libDir));
        }
      }

Admittedly, I'm not very familiar with the CMake code base, but if I'm not mistaken, this is where the extra path gets added, unconditionally. Would there be interest for a PR that adds a property to opt out of this behavior?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information