[cmake-developers] <FLAGS> on Darwin and custom languages

Vittorio Giovara vittorio.giovara at gmail.com
Wed Oct 9 17:56:43 EDT 2013


On Wed, Oct 9, 2013 at 2:18 PM, Brad King <brad.king at kitware.com> wrote:
> On 10/08/2013 07:12 PM, Vittorio Giovara wrote:
>> I noticed that in 2.8.11 under OSX CMake adds -F/Library/Frameworks in
>> every kind of <FLAGS> rule, for any language.
>
> The flag is hard-coded in the C++-implemented generator code under
> the assumption that all compilers on APPLE support -F.  The "-F"
> option appears in a few places literally in the C++ source:
>
> $ git grep -- '"-F"' v2.8.11 -- 'Source/*.cxx'
> v2.8.11:Source/cmCTest.cxx:  if(this->CheckArgument(arg, "-F"))
> v2.8.11:Source/cmLocalGenerator.cxx:          << "-F" << this->Convert(frameworkDir.c_str(),
> v2.8.11:Source/cmLocalGenerator.cxx:    frameworkPath += "-F";
> v2.8.11:Source/cmMakefileTargetGenerator.cxx:        flags += "-F";
> v2.8.11:Source/cmQtAutomoc.cxx:    this->MocIncludes.push_back("-F");
> v2.8.11:Source/ctest.cxx:  {"-F", "Enable failover.", "This option allows ctest to resume a test "
>
> Take a look at the occurrences in cmLocalGenerator.cxx and in
> cmMakefileTargetGenerator.cxx.  The hard-coded "-F" should be
> replaced with a platform information variable lookup that depends
> on the language.  One could introduce a new variable such as
>
>  CMAKE_<LANG>_FRAMEWORK_SEARCH_FLAG
>
> and set it to -F in the upstream platform files but not in your
> pascal file.
>
> -Brad


Hi Brad thank you for your reply and insights.
I'm kinda puzzled though, by your explanation it appears that by
design a flag has been hardcoded in the compiler flags with no option
to disable it. Isn't the role of a build system such as cmake to avoid
making assumptions and allow users to customize its scripts? I also
fail to see the actual need of this addition since
-F/Library/Frameworks is the default framework directory on OSX, and
users needing to change it could just pass it along the other
parameters.

Anyway, I don't want to introduce a variable to change this behaviour,
in my opinion this flag should be either removed from <FLAGS> (or
introduce a policy to remove it) or as a quick hack this flag could be
moved at the beginning so that I could hijack the first element and
pass it to the linker. However either solution will work only for
future releases, what can be done to prevent this wrong behaviour on
the two CMake releases that feature it?

Vittorio



More information about the cmake-developers mailing list