-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
36 lines (25 loc) · 1.26 KB
/
CMakeLists.txt
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
# SPDX-License-Identifier: MIT
# Copyright (c) 2022, Matthew Madison
cmake_minimum_required(VERSION 3.8)
cmake_policy(SET CMP0048 NEW)
project(tegra_eeprom_tool LANGUAGES C VERSION 2.0.2)
include(GNUInstallDirs)
set(CMAKE_C_STANDARD 11)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBEDIT REQUIRED IMPORTED_TARGET libedit)
configure_file(tegra-eeprom.pc.in tegra-eeprom.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tegra-eeprom.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
set(EEPROM_HEADERS boardspec.h cvm.h eeprom.h)
add_library(tegra-eeprom eeprom.c cvm.c boardspec.c ${EEPROM_HEADERS})
set_target_properties(tegra-eeprom PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1)
target_link_libraries(tegra-eeprom PUBLIC PkgConfig::LIBEDIT)
install(TARGETS tegra-eeprom LIBRARY)
install(FILES ${EEPROM_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tegra-eeprom)
add_executable(tegra-eeprom-tool tegra-eeprom-tool.c)
target_link_libraries(tegra-eeprom-tool PUBLIC tegra-eeprom PkgConfig::LIBEDIT)
add_executable(tegra-boardspec tegra-boardspec.c)
target_link_libraries(tegra-boardspec PUBLIC tegra-eeprom PkgConfig::LIBEDIT)
install(TARGETS tegra-eeprom tegra-boardspec tegra-eeprom-tool RUNTIME)