CMakeLists.txt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. execute_process(COMMAND
  25. ${RC_COMPILER} ${RCFILES} -useDF -o ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  26. )
  27. set_source_files_properties(
  28. ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  29. PROPERTIES GENERATED 1
  30. )
  31. # note that for some reason, the makefile and xcode generators use a different
  32. # property to indicate where the Info.plist file is :-/ For that reason, we
  33. # specify it twice so it will work both places
  34. set_target_properties(CFBundleTest PROPERTIES
  35. BUNDLE 1
  36. BUNDLE_EXTENSION plugin
  37. XCODE_ATTRIBUTE_WRAPPER_EXTENSION plugin #sets the extension to .plugin
  38. XCODE_ATTRIBUTE_MACH_O_TYPE mh_bundle
  39. XCODE_ATTRIBUTE_INFOPLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
  40. MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
  41. LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_SOURCE_DIR}/ExportList_plugin.txt\"")
  42. set_source_files_properties(
  43. ${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
  44. ${CMAKE_CURRENT_BINARY_DIR}/Localized.rsrc
  45. PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/English.lproj")
  46. export(TARGETS CFBundleTest FILE ${CMAKE_CURRENT_BINARY_DIR}/exp.cmake)