"Fossies" - the Fresh Open Source Software Archive 
Member "shake-1.0/CMakeLists.txt" (15 Nov 2014, 3987 Bytes) of package /linux/privat/shake-1.0.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 # Copyright (C) 2006-2011 Brice Arnould.
2 #
3 # This file is part of ShaKe.
4 #
5 # ShaKe is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17
18 #### MACROS AND WORKAROUNDS ####
19 CMAKE_MINIMUM_REQUIRED (VERSION 2.4)
20 if(COMMAND cmake_policy) # Needed by CMake 2.4
21 cmake_policy(SET CMP0005 OLD)
22 endif(COMMAND cmake_policy)
23 set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
24
25 MACRO (add_help2man_manpage file command)
26 get_target_property (HELP2MAN_COMMAND ${command} LOCATION)
27 add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file}
28 COMMAND ${HELP2MAN_LOCATION} ARGS -s8 -N -i ${CMAKE_CURRENT_SOURCE_DIR}/doc/fdl-man_insert -I ${CMAKE_CURRENT_SOURCE_DIR}/doc/${command}-man_insert -o ${CMAKE_CURRENT_BINARY_DIR}/${file} ${HELP2MAN_COMMAND}
29 DEPENDS ${command}
30 COMMENT "Building manpage for ${command}")
31 ENDMACRO ()
32
33 #### PROJECT CONFIG ####
34 project (Shake C)
35 set (CPACK_VERSION_MAJOR "1")
36 set (CPACK_VERSION_MINOR "0")
37 set (CPACK_PACKAGE_CONTACT "Brice Arnould <brice.arnould+shake@gmail.com>")
38
39 set (VERSION "${CPACK_VERSION_MAJOR}.${CPACK_VERSION_MINOR}")
40
41 #### System checks ####
42 find_program (HELP2MAN_LOCATION help2man)
43 IF (NOT HELP2MAN_LOCATION)
44 message (SEND_ERROR "Cannot find help2man. Please install it.")
45 ENDIF ()
46
47 #### Targets ####
48 add_executable (shake executive.c judge.c linux.c main.c msg.c signals.c)
49 add_executable (unattr executive.c linux.c signals.c unattr.c)
50 add_help2man_manpage (shake.8 shake)
51 add_help2man_manpage (unattr.8 unattr)
52 add_custom_target (doc ALL
53 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/shake.8
54 ${CMAKE_CURRENT_BINARY_DIR}/unattr.8)
55
56 #### Platform Specific ####
57
58 ## LINUX ##
59 IF (CMAKE_SYSTEM_NAME MATCHES Linux)
60 add_definitions ("-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64") # For 64 bits files
61 add_definitions ("-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112L") # For posix_fallocate
62 list (APPEND CMAKE_REQUIRED_LIBRARIES attr)
63 target_link_libraries (shake attr)
64 target_link_libraries (unattr attr)
65 ELSE ()
66 message ("For now, shake has only been tested under GNU/Linux. I would be really interested by your experience under other OS, if you have time to write me at <brice.arnould+shake@gmail.com>")
67 ENDIF ()
68
69 ## GCC ##
70 IF (CMAKE_COMPILER_IS_GNUCC)
71 set (CMAKE_C_FLAGS "$ENV{CFLAGS} -std=gnu99 -O2 -Wall -Wextra -Wcast-align -Wpointer-arith -Wbad-function-cast -Wno-sign-compare")
72 set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -O0 -ggdb3 -pedantic -Wconversion -Werror -DDEBUG=1")
73 ENDIF ()
74
75 ## ALL ##
76 INCLUDE (CheckIncludeFiles)
77 INCLUDE (CheckFunctionExists)
78 check_function_exists (attr_setf HAVE_LIBATTR)
79 check_function_exists (fallocate HAVE_FALLOCATE)
80 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
81 ${CMAKE_CURRENT_BINARY_DIR}/config.h
82 ESCAPE_QUOTES)
83 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
84
85 ## SANITY CHECK ##
86 IF (NOT HAVE_LIBATTR)
87 message (SEND_ERROR "You need libattr headers for Shake to build. They might be in a package named libattr1-dev or libattr-devel.")
88 ENDIF()
89
90 #### Installation ####
91 install (TARGETS shake unattr
92 DESTINATION bin)
93 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/shake.8 ${CMAKE_CURRENT_BINARY_DIR}/unattr.8
94 DESTINATION share/man/man8)
95 ## Packages ##
96 set (CPACK_PACKAGE_VERSION_MAJOR ${CPACK_VERSION_MAJOR})
97 set (CPACK_PACKAGE_VERSION_MINOR ${CPACK_VERSION_MINOR})
98 set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/GPL.txt)
99 set (CPACK_GENERATOR "STGZ;TGZ;TZ")
100 INCLUDE(CPack)