[CMake] [CMAKE] OS X Framework and their name
Marco Antognini
antognini.marco at gmail.com
Fri May 6 11:21:46 EDT 2011
I'm ending this monologue by this message. I hope this will help someone on day..
Currently, that is with cmake 2.8.4, this is completely not possible. I go through most of the sources
and found cmTarget::GetFullNameInternal. Here is the relevant part of the function :
void cmTarget::GetFullNameInternal(const char* config,
bool implib,
std::string& outPrefix,
std::string& outBase,
std::string& outSuffix)
{
// Use just the target name for non-main target types.
if(this->GetType() != cmTarget::STATIC_LIBRARY &&
this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY &&
this->GetType() != cmTarget::EXECUTABLE)
{
outPrefix = "";
outBase = this->GetName();
outSuffix = "";
return;
}
:
:
}
As you can see if GetType() returns FRAMEWORK then the function will ignore the prefix and suffix.
> 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
>
More information about the CMake
mailing list