-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
101 lines (79 loc) · 2.73 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.27)
project(
PoorMansDisplay
VERSION 0.1
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 20)
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -march=native -flto")
set(PMD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(PMD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(PMD_DEMO_DIR "${CMAKE_CURRENT_SOURCE_DIR}/demo")
set(PMD_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(GNUInstallDirs)
include("${PMD_CMAKE_DIR}/${PROJECT_NAME}Dependencies.cmake")
file(GLOB_RECURSE PMD_SOURCE_FILES "${PMD_SOURCE_DIR}/*.cpp")
file(GLOB_RECURSE PMD_INCLUDE_FILES "${PMD_INCLUDE_DIR}/*.hpp")
add_library(PoorMansDisplay SHARED "${PMD_SOURCE_FILES}")
add_library(PoorMansDisplay::PoorMansDisplay ALIAS PoorMansDisplay)
target_include_directories(
PoorMansDisplay
PUBLIC
$<BUILD_INTERFACE:${PMD_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/pmd>
)
set_target_properties(
PoorMansDisplay
PROPERTIES OUTPUT_NAME "poormansdisplay"
)
target_link_libraries(PoorMansDisplay PNG::PNG JPEG::JPEG)
file(GLOB_RECURSE PMD_DEMO_FILES "${PMD_DEMO_DIR}/*.cpp")
foreach(file ${PMD_DEMO_FILES})
get_filename_component(name "${file}" NAME_WE)
add_executable(${name} "${file}")
target_link_libraries(${name} PoorMansDisplay)
endforeach()
configure_file("${PMD_DEMO_DIR}/DVDLogo.png" "${CMAKE_CURRENT_BINARY_DIR}/DVDLogo.png" COPYONLY)
configure_file("${PMD_DEMO_DIR}/Spinner.png" "${CMAKE_CURRENT_BINARY_DIR}/Spinner.png" COPYONLY)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PMD_CMAKE_DIR}/${PROJECT_NAME}Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
PATH_VARS CMAKE_INSTALL_LIBDIR
)
install(
TARGETS PoorMansDisplay
EXPORT PoorMansDisplay
LIBRARY
COMPONENT pmd
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
#install(
# FILES ${PMD_INCLUDE_FILES}
# COMPONENT pmd
# DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/pmd"
#)
export(
EXPORT PoorMansDisplay
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
EXPORT PoorMansDisplay
NAMESPACE PoorMansDisplay::
COMPONENT pmd
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake"
COMPONENT pmd
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)