Guest User

Untitled

a guest
Jul 8th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. cmake_minimum_required(VERSION 2.6)
  2. set(PROJ auth)
  3. set(AUTHLIB_VERSION "0.1")
  4. project(${PROJ})
  5. set(AUTHLIB "CGI_auth")
  6. set(ATEST auth_test)
  7. set(_VERSION -DPACKAGE_VERSION=\"${AUTHLIB_VERSION}\")
  8. set(HTTPS_DIR "/Data/Misc/SSL") # корень https-сервера
  9. set(SERVER_NAME "localhost") # полное имя сервера
  10. set(FILEDIR "/Data/Misc/html/tmp") # директория для хранения загруженных файлов
  11. set(DBNAME "${HTTPS_DIR}/cgi-bin/user-pass") # путь к базе данных
  12. set(LOCALEDIR "/usr/share/locale")
  13. if(DEFINED DEBUG)
  14. set(_DEBUG -DEBUG) # закомментировать эту строку по окончании "разработки"
  15. endif()
  16. set(_PACKAGE -DGETTEXT_PACKAGE=\"${PROJ}\")
  17. set(_LOCALE -DLOCALEDIR=\"${LOCALEDIR}\")
  18.  
  19. set(ASRC "src/auth.c")
  20. set(ATESTSRC "src/auth_test.c")
  21. set(CMAKE_COLOR_MAKEFILE ON)
  22.  
  23. #aux_source_directory(./src SOURCES)
  24. aux_source_directory(./lib LIBSRCS)
  25. set(LCPATH "locale/ru")
  26. set(CFLAGS -O3 -Wall -Werror -W -std=c99 -D_XOPEN_SOURCE=666 -DDBNAME=\"${DBNAME}\"
  27. -DFILEDIR=\"${FILEDIR}\" -DSERVER_NAME=\"${SERVER_NAME}\")
  28. set(PO_FILE "${LCPATH}/messages.po")
  29. set(MO_FILE "${LCPATH}/LC_MESSAGES/${PROJ}.mo")
  30. set(RU_FILE "${LCPATH}/ru.po")
  31. set(LIBHEADER "src/include/CGI_auth.h")
  32. find_package(PkgConfig REQUIRED)
  33. pkg_check_modules(${PROJ} REQUIRED
  34. sqlite3>=0.23
  35. )
  36. include_directories("src/include" ${${PROJ}_INCLUDE_DIRS})
  37. add_library(${AUTHLIB} SHARED STATIC ${LIBSRCS})
  38. add_executable(${PROJ} ${ASRC})
  39. add_executable(${ATEST} ${ATESTSRC})
  40. target_link_libraries(${PROJ} ${${PROJ}_LIBRARIES} -lcrypt ${AUTHLIB})
  41. target_link_libraries(${ATEST} ${${PROJ}_LIBRARIES} -lcrypt ${AUTHLIB})
  42. link_directories(${${PROJ}_LIBRARY_DIRS} "/usr/local/lib")
  43. add_definitions(${_LOCALE} ${_DEBUG} ${CFLAGS} ${_VERSION} ${_PACKAGE})
  44.  
  45. set(PCFILE "${AUTHLIB}.pc")
  46. configure_file("./lib/${AUTHLIB}.pc.in" ${PCFILE} @ONLY)
  47.  
  48. # Installation of the program
  49. #set(CMAKE_INSTALL_PREFIX ${HTTPS_DIR} CACHE STRING "Install path" FORCE)
  50. install(TARGETS ${PROJ} ${ATEST}
  51. DESTINATION "${HTTPS_DIR}/cgi-bin"
  52. )#PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  53. install(FILES ${MO_FILE}
  54. DESTINATION "${LOCALEDIR}/ru/LC_MESSAGES"
  55. )#PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
  56. install(FILES ${LIBHEADER}
  57. DESTINATION "include"
  58. )
  59. set(CMAKE_INSTALL_SO_NO_EXE "0")
  60. install(TARGETS ${AUTHLIB} LIBRARY
  61. DESTINATION "lib"
  62. ARCHIVE DESTINATION "lib"
  63. )
  64. install(FILES ${PCFILE}
  65. DESTINATION "lib/pkgconfig"
  66. )
  67. # Script to be executed at installation time (kind of post-intallation script) to
  68. # change the right accesses on the installed files
  69. #install(SCRIPT install_html.cmake)
  70.  
  71. if(DEFINED DEBUG)
  72. find_package(Gettext REQUIRED)
  73. find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
  74. if(NOT GETTEXT_XGETTEXT_EXECUTABLE )
  75. message(FATAL_ERROR "xgettext not found")
  76. endif(NOT GETTEXT_XGETTEXT_EXECUTABLE )
  77. endif(DEFINED DEBUG)
  78. add_custom_command(
  79. OUTPUT ${PO_FILE}
  80. COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --from-code=koi8-r ${LIBSRC} -c -k_ -kN_ -o ${PO_FILE}
  81. COMMAND sed 's/charset=UTF-8/charset=koi8-r/' ${PO_FILE} | enconv > tmp && mv -f tmp ${PO_FILE}
  82. COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE}
  83. DEPENDS ${LIBSRC})
  84. add_custom_command(
  85. OUTPUT ${MO_FILE}
  86. COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ${RU_FILE} -o ${MO_FILE}
  87. DEPENDS ${RU_FILE})
Advertisement
Add Comment
Please, Sign In to add comment