forked from bbidulock/icewm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
77 lines (68 loc) · 2.45 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.5)
CMAKE_POLICY (SET CMP0053 NEW)
PROJECT(ICEWM CXX C)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
include(CTest)
set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src)
include_directories(${CMAKE_BINARY_DIR})
IF(NOT DEFINED(CMAKE_INSTALL_PREFIX))
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE STRING "Target file space")
ENDIF()
# iiieh, neeing to add some guards, since having this nested construct
# interacts badly when changing a variable afterwards cmake also insists on
# overwritting that variables later :-( if not protected
IF(NOT DEFINED(DATADIR))
set(DATADIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Shared data files directory")
ENDIF()
IF(NOT DEFINED(LIBDIR))
set(LIBDIR "${DATADIR}/icewm" CACHE STRING "Location of icewm meta data")
ENDIF()
IF(NOT DEFINED(DOCDIR))
set(DOCDIR "${DATADIR}/doc/icewm" CACHE STRING "Location of documentation files")
ENDIF()
IF(NOT DEFINED(LOCDIR))
set(LOCDIR "${DATADIR}/locale" CACHE STRING "System locale data directory")
ENDIF()
IF(NOT DEFINED(CFGDIR))
set(CFGDIR "${CMAKE_INSTALL_PREFIX}/etc/icewm" CACHE STRING "Location of system-wide configuration files")
ENDIF()
IF(NOT DEFINED(ICEHELPIDX))
set(ICEHELPIDX "${DOCDIR}/icewm.html" CACHE STRING "Location of HTML manual entry page")
ENDIF()
IF(NOT DEFINED(BINDIR))
set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
ENDIF()
find_package(Git)
find_program(SED_EXECUTABLE sed)
if(Git_FOUND AND IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
if(NOT DEFINED VERSION)
execute_process(COMMAND "${GIT_EXECUTABLE}" "describe" "--tags"
COMMAND "${SED_EXECUTABLE}" "s,[-_],.,g;s,\\.g.*$,,"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if(NOT DEFINED PACKAGE)
set(PACKAGE "icewm")
endif()
else()
FILE(READ "${CMAKE_SOURCE_DIR}/VERSION" vfilecontents)
STRING(REGEX REPLACE "\n" ";" vfilecontents "${vfilecontents}")
foreach (line ${vfilecontents})
STRING(REGEX REPLACE "=" ";" keyval "${line}")
list(GET keyval 0 _key)
IF(NOT DEFINED ${_key})
list(GET keyval 1 ${_key})
ENDIF()
endforeach()
endif()
set(PACKAGE_STRING ${PACKAGE})
add_subdirectory(src)
add_subdirectory(po)
add_subdirectory(lib)
add_subdirectory(doc)
add_subdirectory(man)
install(FILES icewm-set-gnomewm contrib/icewm-menu-xrandr DESTINATION ${BINDIR} PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE WORLD_READ OWNER_READ OWNER_WRITE GROUP_READ)
# vim: set sw=2 ts=2 noet: