1 cmake_minimum_required (VERSION 2.8)
2 set (CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
3 set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
9 set (PROJECT_VERSION "0.0.1")
11 include (CheckFunctionExists)
12 include (CheckStructHasMember)
13 include (CheckCXXCompilerFlag)
15 message ("-- Looking for SHA1 references")
16 if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
17 set (HAVE_COMMIT true)
18 execute_process (COMMAND git log -1 --pretty=format:%h
19 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
20 OUTPUT_VARIABLE COMMIT)
21 configure_file ( ${CMAKE_SOURCE_DIR}/commit.h.in
22 ${CMAKE_SOURCE_DIR}/commit.h)
23 message ("-- Found SHA1 reference: ${COMMIT}")
24 endif (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
26 set (PACKAGE "${PROJECT_NAME}")
27 set (VERSION "${PROJECT_VERSION}")
28 set (PACKAGE_NAME "${PACKAGE}")
29 set (PACKAGE_TARNAME "${PACKAGE}")
30 set (PACKAGE_VERSION "${VERSION}")
31 set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
33 SET (GEN-SHELL_DOCDIR share/doc/gen-shell CACHE STRING "Installation directory for doc files")
34 SET (GEN-SHELL_RCDIR "${GEN-SHELL_DOCDIR}/rc" CACHE STRING "Installation directory for configuration files")
35 SET (GEN-SHELL bin CACHE STRING "Installation directory for the binary")
37 # include the readline library finder module
38 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
41 message ("-- Looking for GNU Readline")
42 find_package (Readline REQUIRED)
44 set (HAVE_READLINE true)
45 set (GEN-SHELL_INCLUDE_DIRS ${GEN-SHELL_INCLUDE_DIRS} ${READLINE_INCLUDE_DIR})
46 set (GEN-SHELL_LIBRARIES ${GEN-SHELL_LIBRARIES} ${READLINE_LIBRARIES})
47 endif (READLINE_FOUND)
49 message ("-- Configuring cmake.h")
51 ${CMAKE_SOURCE_DIR}/cmake.h.in
52 ${CMAKE_SOURCE_DIR}/cmake.h)
54 add_subdirectory (src)
55 add_subdirectory (doc)
56 if (EXISTS ${CMAKE_SOURCE_DIR}/test)
57 add_subdirectory (test EXCLUDE_FROM_ALL)
58 endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
60 set (doc_FILES NEWS ChangeLog INSTALL AUTHORS COPYING)
61 foreach (doc_FILE ${doc_FILES})
62 install (FILES ${doc_FILE} DESTINATION ${GEN-SHELL_DOCDIR})
67 set (CPACK_SOURCE_GENERATOR "TGZ")
68 set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
69 set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig"
70 "_CPack_Packages" "cmake_install" "install_manifest" "Makefile$"
71 "test" "package-config" "misc/*" "src/gen-shell$" "README.md"
72 "/\\\\.gitignore" "/\\\\.git/" "swp$")