diff options
author | Deposite Pirate | 2018-09-16 22:59:20 +0200 |
---|---|---|
committer | Deposite Pirate | 2018-09-16 22:59:20 +0200 |
commit | b093ec191d2763c6395a9db467402ab9d8fb619a (patch) | |
tree | 8af8fcd96a289b61430f1bd03a008340aaf94d0c | |
parent | 70083671824589998eb60feadb1063f4c5b79931 (diff) |
-rw-r--r-- | CMakeLists.txt | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4ee920e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,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") |