[CMake] Adding Mac OS X Style Frameworks On Linux

Karol Krizka kkrizka at gmail.com
Thu Apr 15 23:59:11 EDT 2010


Hi,

On Thu, Apr 8, 2010 at 1:45 PM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Wednesday 31 March 2010, Karol Krizka wrote:
>> Hi there,
>>
>> I am trying to use CMake to develop Apps for a jailbroken iPhone using
>> the iphonedevonlinux toolchain[1]. I got the toolchain to work and
>> build the included test app, HelloToolchain. What I am trying to do
>> next is write a CMakeLists.txt for this test App. I renamed it as
>> KKToolchain for CMake enabled testing. Anyways, if you want to see
>> what the Makefile should look like, see here[2].
>>
>> The way I am trying to accomplish is to use CMake's Cross Compiling
>> support[3]. As per the WiKi entry, I've created a toolchain file
<snip>
>> As you can see, it correctly finds the Foundation framework in my
>> toolchain. But it complains when I try to link to it. I am assuming
>> that this is because linking to frameworks in only supported on Mac OS
>> X. Is this true? If so, is there some other way around it?
>
> Please put this in the cmake bug tracker at http://public.kitware.com/Bug/
>
> About the linking-to-frameworks... I remember there is something hardcoded
> somewhere which detects whether something is a framework and then does
> something... will have to look.
> Maybe somewhere a change from an #ifdef to something like a if (systemname
> == "Darwin") might help...
>
You are right. On line 1329 of Source/cmComputeLinkInformation.cxx
(current git), I see:

  #ifdef __APPLE__
  if(cmSystemTools::IsPathToFramework(item.c_str()))
    {
    this->AddFrameworkItem(item);
    }
  else
    #endif

Commenting out the ifdef __APPLE__ makes everything work as I would like it to.

Also changing the block into the following helped:

  std::string systemName =
this->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME");
  if(systemName == "Darwin" && cmSystemTools::IsPathToFramework(item.c_str()))
    {
    this->AddFrameworkItem(item);
    }
  else
    {
    this->DropDirectoryItem(item);
    }

--
Cheers,
Karol Krizka
http://www.krizka.net


More information about the CMake mailing list