-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (32 loc) · 1.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
cmake_minimum_required(VERSION 2.8)
project(CMake-docset)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
set(CMAKE_DOCSET_ROOT CMake.docset)
find_program( SQLITE_COMMAND NAMES sqlite3 sqlite )
if(EXISTS ${CMAKE_BINARY_DIR}/docSet.dsidx)
file(REMOVE ${CMAKE_BINARY_DIR}/docSet.dsidx)
endif()
install(CODE "execute_process(COMMAND echo .quit
COMMAND ${SQLITE_COMMAND} -init ${CMAKE_CURRENT_SOURCE_DIR}/schema.sql ${CMAKE_BINARY_DIR}/docSet.dsidx )")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake.xml.in ${CMAKE_BINARY_DIR}/CMake.xml)
macro(ADD_SQLITE_INDEX type list docset)
set(CMAKE_HELP_TYPE ${type})
set(CMAKE_HELP_LIST ${list})
set(CMAKE_HELP_DOCSET_TYPE ${docset})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index.sh.in ${CMAKE_BINARY_DIR}/index_${CMAKE_HELP_TYPE}.sh)
install(CODE "execute_process(COMMAND ${CMAKE_BINARY_DIR}/index_${CMAKE_HELP_TYPE}.sh
COMMAND ${SQLITE_COMMAND} ${CMAKE_BINARY_DIR}/docSet.dsidx )")
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --help-${list} ${CMAKE_BINARY_DIR}/cmake-${list}.html)")
install(FILES ${CMAKE_BINARY_DIR}/cmake-${list}.html DESTINATION ${CMAKE_DOCSET_ROOT}/Contents/Resources/Documents/)
endmacro(ADD_SQLITE_INDEX)
ADD_SQLITE_INDEX(command commands Command)
ADD_SQLITE_INDEX(property properties Property)
ADD_SQLITE_INDEX(variable variables Variable)
ADD_SQLITE_INDEX(module modules Module)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon.png DESTINATION ${CMAKE_DOCSET_ROOT})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist DESTINATION ${CMAKE_DOCSET_ROOT}/Contents)
install(FILES ${CMAKE_BINARY_DIR}/docSet.dsidx DESTINATION ${CMAKE_DOCSET_ROOT}/Contents/Resources/)
set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_FILE_NAME "CMake")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY False)
include(CPack)