Create CMakeLists.txt

This is an example to build and link this library with cmake
This commit is contained in:
Pavel Shlyak 2022-01-10 15:23:20 +03:00 committed by GitHub
parent 0cca3ac8ff
commit 271610ee7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.16)
project(u8g2_4wire_hw_spi)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D __ARM_LINUX__")
set(SOURCE_EXE u8g2_4wire_hw_spi.cpp)
set (U8G2_PATH ../../../../../)
AUX_SOURCE_DIRECTORY(${U8G2_PATH}/csrc/ CSRC_FILES)
AUX_SOURCE_DIRECTORY(${U8G2_PATH}/sys/arm-linux/drivers DRV_FILES)
AUX_SOURCE_DIRECTORY(${U8G2_PATH}/sys/arm-linux/port/ PORT_FILES)
set(SOURCE_LIB ${CSRC_FILES} ${DRV_FILES} ${PORT_FILES})
include_directories(${U8G2_PATH}/csrc/)
include_directories(${U8G2_PATH}/sys/arm-linux/drivers)
include_directories(${U8G2_PATH}/sys/arm-linux/port/)
add_library(u8g2 SHARED ${SOURCE_LIB})
add_executable(u8g2_4wire_hw_spi ${SOURCE_EXE})
target_link_libraries(u8g2_4wire_hw_spi u8g2)