mirror of
https://git.familie-radermacher.ch/linux/ptouch-print.git
synced 2025-12-05 19:05:26 +00:00
Add support for cmake as build system
This commit is contained in:
committed by
Dominic Radermacher
parent
dbadcaef81
commit
679c51859b
61
CMakeLists.txt
Normal file
61
CMakeLists.txt
Normal file
@@ -0,0 +1,61 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(ptouch_print C)
|
||||
|
||||
# Configure CMake
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
# Configure required dependencies
|
||||
find_package(Gettext REQUIRED)
|
||||
find_package(GD REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
||||
|
||||
# Configure names and versions
|
||||
execute_process(COMMAND bash "${CMAKE_CURRENT_LIST_DIR}/build-aux/git-version-gen" OUTPUT_VARIABLE VERSION)
|
||||
|
||||
# Configure project executable
|
||||
add_executable(ptouch_print)
|
||||
|
||||
target_sources(ptouch_print
|
||||
PUBLIC
|
||||
include/ptouch.h
|
||||
PRIVATE
|
||||
include/gettext.h
|
||||
src/libptouch.c
|
||||
src/ptouch-print.c
|
||||
)
|
||||
|
||||
# Configure compiler
|
||||
target_compile_options(ptouch_print
|
||||
PRIVATE
|
||||
-g
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wunused
|
||||
-O3
|
||||
-fPIC
|
||||
)
|
||||
|
||||
target_compile_definitions(ptouch_print
|
||||
PRIVATE
|
||||
LOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}"
|
||||
USING_CMAKE=1
|
||||
VERSION="${VERSION}"
|
||||
PACKAGE="ptouch"
|
||||
|
||||
)
|
||||
|
||||
target_include_directories(ptouch_print
|
||||
PRIVATE
|
||||
include
|
||||
${GD_INCLUDE_DIR}
|
||||
${LIBUSB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Configure linker
|
||||
target_link_libraries(ptouch_print
|
||||
${GD_LIBRARIES}
|
||||
${LIBUSB_LIBRARIES}
|
||||
)
|
||||
Reference in New Issue
Block a user