]> git.armaanb.net Git - gen-shell.git/blob - CMakeLists.txt
about as detasked as it will be
[gen-shell.git] / CMakeLists.txt
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")
4 set (HAVE_CMAKE true)
5
6 project (gen-shell)
7 include (CXXSniffer)
8
9 set (PROJECT_VERSION "0.0.1")
10
11 include (CheckFunctionExists)
12 include (CheckStructHasMember)
13 include (CheckCXXCompilerFlag)
14
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  message ("-- Found SHA1 reference: ${COMMIT}")
22 endif (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
23
24 set (PACKAGE "${PROJECT_NAME}")
25 set (VERSION "${PROJECT_VERSION}")
26 set (PACKAGE_NAME "${PACKAGE}")
27 set (PACKAGE_TARNAME "${PACKAGE}")
28 set (PACKAGE_VERSION "${VERSION}")
29 set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
30
31 SET (GEN-SHELL_DOCDIR  share/doc/gen-shell CACHE STRING "Installation directory for doc files")
32 SET (GEN-SHELL_RCDIR "${GEN-SHELL_DOCDIR}/rc" CACHE STRING "Installation directory for configuration files")
33 SET (GEN-SHELL bin                 CACHE STRING "Installation directory for the binary")
34
35 # include the readline library finder module
36 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
37
38 # find readline
39 message ("-- Looking for GNU Readline")
40 find_package (Readline REQUIRED)
41 if (READLINE_FOUND)
42   set (HAVE_READLINE true)
43   set (GEN-SHELL_INCLUDE_DIRS ${GEN-SHELL_INCLUDE_DIRS} ${READLINE_INCLUDE_DIR})
44   set (GEN-SHELL_LIBRARIES    ${GEN-SHELL_LIBRARIES}    ${READLINE_LIBRARIES})
45 endif (READLINE_FOUND)
46
47 message ("-- Configuring cmake.h")
48 configure_file (
49   ${CMAKE_SOURCE_DIR}/cmake.h.in
50   ${CMAKE_SOURCE_DIR}/cmake.h)
51
52 add_subdirectory (src)
53 if (EXISTS ${CMAKE_SOURCE_DIR}/test)
54   add_subdirectory (test EXCLUDE_FROM_ALL)
55 endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
56
57 # ---
58
59 set (CPACK_SOURCE_GENERATOR "TGZ")
60 set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
61 set (CPACK_SOURCE_IGNORE_FILES  "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig"
62                                 "_CPack_Packages" "cmake_install" "install_manifest" "Makefile$"
63                                 "test" "package-config" "misc/*" "src/gen-shell$" "README.md"
64                                 "/\\\\.gitignore" "/\\\\.git/" "swp$")
65 include (CPack)