Cmake now is able to build SFML libraries as frameworks (closes #12)

Cmake can now automatically install the Xcode templates
This commit is contained in:
Marco Antognini 2011-08-20 12:14:55 +02:00
parent e5d635350e
commit e09db44906
3 changed files with 113 additions and 24 deletions

View file

@ -138,17 +138,29 @@ macro(sfml_add_library target)
target_link_libraries(${target} ${THIS_DEPENDS})
endif()
# build frameworks or dylibs
if(MACOSX AND BUILD_SHARED_LIBS)
if(BUILD_FRAMEWORKS)
# adapt target to build frameworks instead of dylibs
set_target_properties(${target} PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.${target}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
else()
# adapt install directory to allow distributing dylibs in users frameworks
set_target_properties(${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path/../Frameworks")
endif()
endif()
# link the target to its external dependencies
if(THIS_EXTERNAL_LIBS)
if(BUILD_SHARED_LIBS)
# in shared build, we use the regular linker commands
target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
if (MACOSX)
set_target_properties(${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path/../Frameworks")
endif()
target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
else()
# in static build there's no link stage, but with some compilers it is possible to force
# the generated static library to directly contain the symbols from its dependencies
@ -160,7 +172,8 @@ macro(sfml_add_library target)
install(TARGETS ${target}
RUNTIME DESTINATION bin COMPONENT bin
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel
FRAMEWORK DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX} COMPONENT bin)
endmacro()