blob: 4ee920edbb020e37525cc344a3de5c099baca460 (
plain)
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
|
project(compface C)
cmake_minimum_required(VERSION 2.8)
set(VERSION "1.5.2")
add_definitions(-DHAVE_CONFIG_H)
include(CheckIncludeFiles)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(errno.h HAVE_ERRNO_H)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(io.h HAVE_IO_H)
include(CheckFunctionExists)
check_function_exists(strerror HAVE_STRERROR)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
set(PKGCONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/compface.pc")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compface.pc.in ${PKGCONFIG_FILE} @ONLY)
set(LIBRARY_SOURCES arith.c file.c compress.c gen.c uncompface.c)
set(PRIVATE_HEADERS data.h compface_private.h)
set(PUBLIC_HEADERS compface.h)
add_library(libshared SHARED ${LIBRARY_SOURCES} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS})
add_library(libstatic STATIC ${LIBRARY_SOURCES} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS})
set_target_properties(libshared libstatic PROPERTIES OUTPUT_NAME compface)
set_target_properties(libshared PROPERTIES VERSION 1.0.0)
set_target_properties(libshared PROPERTIES SOVERSION 1)
#set_target_properties(libshared PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/libcompface.def")
add_executable(compface cmain.c compface.c)
add_executable(uncompface uncmain.c)
target_link_libraries(uncompface libshared)
target_link_libraries(compface libshared)
install(TARGETS libshared libstatic compface uncompface
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}")
install(FILES ${PUBLIC_HEADERS} DESTINATION "${INSTALL_INC_DIR}")
install(FILES ${PKGCONFIG_FILE} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
install(FILES compface.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
install(FILES compface.1 uncompface.1 DESTINATION "${INSTALL_MAN_DIR}/man1")
|