[CMake] Framework + Unix tools help

Carlos Gonçalves mail at cgoncalves.info
Fri Aug 13 17:29:34 EDT 2010


On 2010/08/13, at 08:52, Michael Wild wrote:

> 
> On 12. Aug, 2010, at 22:41 , Carlos Gonçalves wrote:
> 
>> Hi,
>> 
>> On 2010/08/12, at 20:15, Chris Wolf wrote:
>> 
>>> 
>>> 
>>> On 8/12/10 10:20 AM, Carlos Gonçalves wrote:
>>>> Hi,
>>>> 
>>>> I have already looked everywhere possible (so to speak) on how to create a Framework + Unix tools as described in [1] but found no examples. So far I was able to create a Framework only [2].
>>>> 
>>>> I'm trying to add Mac OS X support to GeneratorRunner[3] and my current CMakeLists.txt can be viewed in [4]. Any help would be appreciated :-)
>>>> 
>>>> Thanks,
>>>> Carlos Gonçalves
>>>> 
>>>> [1] http://www.cmake.org/Wiki/CMake:Bundles_And_Frameworks#Framework_.2B_Unix_tools
>>>> [2] http://www.cmake.org/Wiki/CMake:Bundles_And_Frameworks#Framework_only
>>>> [3] http://qt.gitorious.org/pyside/generatorrunner
>>>> [4] http://pastebin.com/p7CKYP2z
>>> 
>>> I am not certain about your main question - but looking at your code, I see you have:
>>> 
>>> add_custom_target(dist...
>>> 
>>> ...which creates a file, "ChangeLog.txt" from the git log, then creates an
>>> archive.  You only need to create the "ChangeLog.txt" file here; you 
>>> don't need to create temp dirs and invoke tar and bzip2 - cpack can
>>> do that for you, via the defined package generators.
>> 
>> That's a custom target to create a new release tarball, so nothing to do with my question :-)
>> 
>>> For creating source and/or binary archives, just use one of the CPack
>>> package generators:
>>> 
>>> http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#TBZ2
>>> 
>>> To create the configured binary package(s), either invoke "make package"
>>> or invoke cpack directly:  "cpack"
>>> 
>>> To create the configured source package, either invoke cpack via:
>>> "make package_source" or directly via:
>>> "cpack --config ./CPackSourceConfig.cmake"
>>> 
>>> 
>>> Sorry I couldn't answer your "real" question... ;)
>> 
>> My fault, not yours. Ok, let me explain it better.
>> 
>> GeneratorRunner builds successfully on Linux and installs just fine. Now, I want to add Mac OS X support on it. Since GeneratorRunner contains an application (generatorrunner) and a library (genrunner) the installation file hierarchy should be, for what I have understand, something equivalent to the example given in http://www.cmake.org/Wiki/CMake:Bundles_And_Frameworks#Framework_.2B_Unix_tools
>> 
>> -- Installing: /Library/Frameworks/genrunner.framework
>> -- Installing: /Library/Frameworks/genrunner.framework/genrunner
>> -- Installing: /Library/Frameworks/genrunner.framework/Resources
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/genrunner
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/cmake
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/cmake/GeneratorRunner-0.6.1
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/cmake/GeneratorRunner-0.6.1/GeneratorRunnerConfig.cmake
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/cmake/GeneratorRunner-0.6.1/GeneratorRunnerConfigVersion.cmake
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/pkgconfig
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/lib/pkgconfig/generatorrunner.pc
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/Resources
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/0.6.1/Resources/Info.plist
>> -- Installing: /Library/Frameworks/genrunner.framework/Versions/Current
>> -- Installing: /Applications/GeneratorRunner/bin/generatorrunner
>> 
>> My question is mainly about file /Applications/GeneratorRunner/bin/generatorrunner which, although I've set it to be installed there for testing purposes, what I want is it so be installed either in /Library/Frameworks/genrunner.framework/Versions/0.6.1/Commands/generatorrunner or in Library/Frameworks/genrunner.framework/Versions/0.6.1/bin/generatorrunner (I truly don't know what the difference between Commands/ and bin/ is since they both contain executables), but I don't know how to do it. I tried messing with RUNTIME DESTINATION setting it to "bin" but that didn't help.
>> 
>> Hope I have clarified my question ;-)
>> 
>> Thanks,
>> Carlos Gonçalves
> 
> Now you only have to use execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ...) to create a symlink somewhere in your build tree that points to the executable inside the framework (either using a relative path or the absolute install-path) and then install it using install(FILES ...).

But how do I install the executable inside the framework dir? What I have now is:

install(TARGETS genrunner generatorrunner
     RUNTIME DESTINATION bin
     FRAMEWORK DESTINATION Library/Frameworks
     LIBRARY DESTINATION lib${LIB_SUFFIX}
     ARCHIVE DESTINATION lib${LIB_SUFFIX}
     PUBLIC_HEADER DESTINATION include/generatorrunner
     RESOURCE DESTINATION lib${LIB_SUFFIX}/cmake
)

The executable is installed in /bin/generatorrunner rather than /Library/Frameworks/genrunner.framework/Versions/0.6.1/bin/. Even though I want this on Mac OS X I'd also want it be installed on $prefix/usr/bin/ on non-Mac OS X platforms same way headers are installed in Headers/ but in $prefix/include/ (PUBLIC_HEADER) and $prefix/lib${LIB_SUFFIX} (RESOURCE) on non-Mac OS X platforms.

Thanks,
Carlos Gonçalves


More information about the CMake mailing list