forked from naelstrof/maim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
84 lines (70 loc) · 2.85 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
78
79
80
81
82
83
84
cmake_minimum_required( VERSION 3.1.3 )
project(maim VERSION 5.7.4 LANGUAGES CXX)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif()
include(GNUInstallDirs)
add_definitions(-DMAIM_VERSION="v${PROJECT_VERSION}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
# Sources
set( source
src/x.cpp
src/image.cpp
src/main.cpp )
set( BIN_TARGET "${PROJECT_NAME}" )
# Executable
add_executable( "${BIN_TARGET}" ${source} )
# Obtain library paths and make sure they exist.
set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/modules" )
find_package( PNG REQUIRED )
find_package( JPEG REQUIRED )
find_package( WebP REQUIRED )
find_package( XRandr REQUIRED )
find_package( XRender REQUIRED )
find_package( XFixes REQUIRED )
find_package( XComposite REQUIRED )
find_package( X11 REQUIRED )
find_package( SLOP REQUIRED )
find_package( Threads REQUIRED )
find_package( GLM REQUIRED )
set_property(TARGET ${BIN_TARGET} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${BIN_TARGET} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${BIN_TARGET} PROPERTY CXX_EXTENSIONS OFF)
# Includes
include_directories( ${XRANDR_INCLUDE_DIR}
${X11_INCLUDE_DIR}
${SLOP_INCLUDE_DIR}
${GLM_INCLUDE_DIR}
${XFIXES_INCLUDE_DIR}
${XCOMPOSITE_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${XRANDR_INCLUDE_DIR}
${XRENDER_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${WEBP_INCLUDE_DIR} )
# Libraries
target_link_libraries( ${BIN_TARGET}
${CMAKE_THREAD_LIBS_INIT}
${X11_LIBRARIES}
${PNG_LIBRARIES}
${XFIXES_LIBRARY}
${XCOMPOSITE_LIBRARY}
${XRANDR_LIBRARY}
${JPEG_LIBRARIES}
${XRENDER_LIBRARY}
${SLOP_LIBRARIES}
${WEBP_LIBRARY} )
if( ${CMAKE_VERSION} VERSION_LESS 3.7 )
message( WARNING "CMake version is below 3.7, CMake version >= 3.7 is required for unicode support." )
else()
find_package(ICU COMPONENTS uc)
set( MAIM_UNICODE TRUE CACHE BOOL "To enable or disable unicode support." )
if ( MAIM_UNICODE AND ICU_FOUND )
# ICU is required for old nvidia drivers to work for whatever reason.
add_definitions(-DCXXOPTS_USE_UNICODE)
include_directories( ${ICU_INCLUDE_DIR} )
target_link_libraries( ${BIN_TARGET} ${ICU_UC_LIBRARIES} )
endif()
endif()
install( TARGETS ${BIN_TARGET} DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install( FILES "${CMAKE_SOURCE_DIR}/maim.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )