CMakeLists.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #this is adapted from FireBreath (http://www.firebreath.org)
  2. cmake_minimum_required(VERSION 2.8)
  3. project(CFBundleTest)
  4. include(PluginConfig.cmake)
  5. message ("Creating Mac Browser Plugin project ${PROJECT_NAME}")
  6. set(SOURCES
  7. np_macmain.cpp
  8. Localized.r
  9. ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
  10. ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
  11. ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  12. )
  13. add_library( ${PROJECT_NAME} MODULE
  14. ${SOURCES}
  15. )
  16. set (RCFILES ${CMAKE_CURRENT_SOURCE_DIR}/Localized.r)
  17. configure_file(Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
  18. configure_file(InfoPlist.strings.in ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings)
  19. # Compile the resource file
  20. find_program(RC_COMPILER Rez NO_DEFAULT_PATHS PATHS /Developer/Tools)
  21. if(NOT RC_COMPILER)
  22. message(FATAL_ERROR "could not find Rez to build resources from .r file...")
  23. endif()
  24. set(sysroot)
  25. if(CMAKE_OSX_SYSROOT)
  26. set(sysroot -isysroot ${CMAKE_OSX_SYSROOT})
  27. endif()
  28. execute_process(COMMAND
  29. ${RC_COMPILER} ${sysroot} ${RCFILES} -useDF
  30. -o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  31. )
  32. set_source_files_properties(
  33. ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  34. PROPERTIES GENERATED 1
  35. )
  36. # note that for some reason, the makefile and xcode generators use a different
  37. # property to indicate where the Info.plist file is :-/ For that reason, we
  38. # specify it twice so it will work both places
  39. set_target_properties(CFBundleTest PROPERTIES
  40. BUNDLE 1
  41. BUNDLE_EXTENSION plugin
  42. XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle
  43. XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
  44. MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
  45. LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/ExportList_plugin.txt\"")
  46. set_source_files_properties(
  47. ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
  48. ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  49. PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/English.lproj")
  50. export(TARGETS CFBundleTest FILE ${CMAKE_CURRENT_BINARY_DIR}/exp.cmake)