-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·64 lines (51 loc) · 1.7 KB
/
CMakeLists.txt
File metadata and controls
executable file
·64 lines (51 loc) · 1.7 KB
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
project(cph C)
cmake_minimum_required(VERSION 2.6)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_BINARY_DIR})
option(GTK "build with gtk" OFF)
#
# Project Output Paths
#
SET (MAINFOLDER ${PROJECT_SOURCE_DIR})
SET (EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin")
#
# Project Search Paths
#
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/tools")
SET (CMAKE_MODULE_PATH "${MAINFOLDER}/tools/share/cmake")
INCLUDE(CPack)
set(SOURCE
src/cph.c
src/cph_args.c
src/cph_io.c
src/cph_memory.c
src/cph_key.c)
set(HEADERS
src/cph.h
src/cph_args.h
src/cph_io.h
src/cph_memory.h
src/cph_key.h)
# There are lots of scripts with cmake for finding external libraries.
# see /usr/local/share/cmake-2.6/Modules/Find*.cmake for more examples
find_package(Libgcrypt REQUIRED)
# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
if (GTK)
add_definitions(-DGTK)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
# Add other flags to the compiler
add_definitions(${GTK3_CFLAGS_OTHER})
endif()
add_executable(cph ${SOURCE} ${HEADERS})
# Link the target to the GTK+ libraries
target_link_libraries(cph ${GTK3_LIBRARIES} ${LIBGCRYPT_LIBS})
install(TARGETS cph DESTINATION bin)