[CMake] OS X Framework and their name

Marco Antognini antognini.marco at gmail.com
Fri Apr 22 06:32:37 EDT 2011


Hi again,

I assume this is kind of tricky seen the number of answer. hehe

Just a quick summary of my situation and what I want to achieve :
Currently I can produce 'sfml-system.framework' for debug and release configuration. I use something like this :

    # add the install rule
    # if Mac OS X and the user wants some frameworks we setup CMake accordingly
    if(MACOSX AND BUILD_FRAMEWORKS)
        set_target_properties(${target} PROPERTIES FRAMEWORK TRUE)
        set_target_properties(${target} PROPERTIES FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
        
        # setup Info.plist
        set_target_properties(${target} PROPERTIES MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.${target})
        set_target_properties(${target} PROPERTIES MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
        set_target_properties(${target} PROPERTIES MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

        install(TARGETS ${target}
                FRAMEWORK DESTINATION "/Library/Frameworks" COMPONENT bin)

    # 'classic' install (Windows and Linux)
    else()
        install(TARGETS ${target}
                RUNTIME DESTINATION bin COMPONENT bin
                LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin 
                ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
    endif()

where BUILD_FRAMEWORKS is an user option and target is for example 'sfml-system'.

When installing it does something like :

-- Installing: /Library/Frameworks/sfml-system.framework
-- Installing: /Library/Frameworks/sfml-system.framework/Resources
-- Installing: /Library/Frameworks/sfml-system.framework/Versions
-- Installing: /Library/Frameworks/sfml-system.framework/Versions/2.0.0
-- Installing: /Library/Frameworks/sfml-system.framework/Versions/2.0.0/Resources
-- Installing: /Library/Frameworks/sfml-system.framework/Versions/2.0.0/Resources/Info.plist
-- Installing: /Library/Frameworks/sfml-system.framework/Versions/2.0.0/sfml-system
-- Installing: /Library/Frameworks/sfml-system.framework/Versions/Current
-- Installing: /Library/Frameworks/sfml-system.framework/sfml-system

Now I want to change this a little bit to be able to produce 
- 'sfml-system.framework' for release mode
- 'sfml-system-d.framework' for debug mode

How can I do that without changing the target name ?

DEBUG_POSTFIX doesn't work here. Can I force CMake to use it anyway ?
I wasn't able to use SUFFIX too.

Is there any way to do that ?

I also heard about DYLD_IMAGE_SUFFIX which could be a good alternative to my problem.
(More on that here : http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html%23SECDEBUGLIB)
Does anyone of you how to produce _debug binary inside the framework with CMake ?

Thanks for you help!

Marco Antognini

> Hi,
> 
> I'm currently trying to produce a framework with CMake where its name depend on the build type (release vs debug). For example in release mode I want "sfml-system.framework" (which I get). Now I'm trying to get "sfml-system-d.framework" in debug mode.
> 
> I've read in another mail that DEBUG_POSTFIX will be ignored (because it would break include like <sfml-system/someHeader.h> but I don't have any header in this framework so it doesn't matter in this case) so I unsuccessfully tried to play with SUFFIX (have I done something wrong ?).
> 
> One really bad solution would be to change the target name (sfml-system) directly but this would implies to change also this name in other targets where sfml-system is a dependency.
> 
> How can I do that in a nice way ? Any thoughts ? Is there any properties of he target to be setup in order to achieve this?
> 
> Please tell me if I forgot any relevant information.
> 
> Regards,
> 
> Marco Antognini



More information about the CMake mailing list