[CMake] MacOS bundle using MACOS_PACKAGE_LOCATION with XCode - files not copied
Pierre Aufrère
paufrere at koalabs-studio.com
Thu May 30 08:38:13 EDT 2013
On 30 mai 2013, at 05:37, clinton at elemtech.com wrote:
>
>
> ----- Original Message -----
>> Hello,
>>
>> I'm using cmake to generate an Xcode project which is supposed to build a
>> bundle. Thus, I use the source file property MACOSX_PACKAGE_LOCATION to
>> place my data (database, GUI, localization files, …) in the correct
>> directory in my bundle.
>>
>> I used to have a general CMakeLists.txt with several commands like follows:
>>
>> file(GLOB VAR_GUI
>> ${RESOURCE_PATH}/GUI/*
>> )
>> set_source_files_properties(
>> ${VAR_GUI}
>> PROPERTIES
>> MACOSX_PACKAGE_LOCATION Resources/GUI
>> )
>>
>> Then one command to concatenate all the independent variables (used to
>> separate the different directories)
>> set(RESOURCES "${VAR_GUI};…")
>>
>> Finally, in my main CMakeLists.txt i wrote :
>> add_executable(${CMAKE_PROJECT_NAME} MACOSX_BUNDLE ${SOURCES} ${HEADERS}
>> ${RESOURCES})
>>
>> So every data of my project was more or else added by hand. I wanted to
>> automated the process so i wrote a python script that does the job for me.
>> The script proceeds by writing a file in which each directory of my resource
>> directory has its own variable listing the files in it (semi-colon separated
>> element list). It also generate a set of 'source_group' command to organize
>> resources in the IDE.
>> The generated file is included in my main CMakeLists.txt using the 'include'
>> command.
>>
>> The generated file use commands like follows:
>>
>> set(RESOURCE_GUI
>> <path_to_file_1>;<path_to_file_2>;…
>> )
>>
>> set_source_files_properties(
>> ${RESOURCE_GUI}
>> PROPERTIES
>> MACOSX_PACKAGE_LOCATION Resources/GUI
>> )
>>
>> Unfortunately, with this new generated included file, the resources are
>> successfully added to the Xcode project but when I build the project, the
>> resources are no longer copied into the bundle.
>>
>> I checked that the include command wasn't the issue since my old commands
>> (hand written) works when i put them in the included file (in place of the
>> generated commands).
>> Trying to figure out the issue, I notice that in Xcode, the only difference
>> between resources added by my generated file and the old ones is that the
>> old commands were in the end marking my resources file as target member
>> (target membership is checked in Xcode). With the generated file, the
>> resources are in the project but not marked as member of the target.
>> I thought maybe the 'file' command was setting other source file properties
>> like EXTERNAL_OBJECT so i tried setting it up by hand, but it doesn't work
>> either.
>
>
> Does your add_executable() include ${RESOURCE_GUI} after your changes?
>
> Clint
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
Hi,
Thanks for your reply. Yes it does include all the necessary variables.
It appears it's a mistake in my generated file, the property set on source file was not correct (MACOSX_… was missing the 'X'). Even though I did checked it, I managed to miss the error in my script and just find it today. So, my mistake. sorry.
Thanks anyway.
Pierre
More information about the CMake
mailing list