-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
44 lines (33 loc) · 1.24 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
cmake_minimum_required(VERSION 3.10)
project(mjpeg-avi)
# Set the C standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED True)
# Add the directory where the source files are located
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
# Create a list of source files for the library
set(LIB_SOURCES "${SOURCE_DIR}/avi.c")
# Create a list of source files for the executable
set(EXE_SOURCES "${SOURCE_DIR}/main.c")
# Define the shared library
add_library(mjpegavi SHARED ${LIB_SOURCES})
# Create the main program executable
add_executable(avimake ${EXE_SOURCES})
target_compile_options(mjpegavi PRIVATE -Wno-multichar)
# Link the executable to the library
target_link_libraries(avimake PRIVATE mjpegavi)
# Include header files location
target_include_directories(avimake PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>)
# Include header files location
target_include_directories(mjpegavi PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>)
# Set install rules for the executable
install(TARGETS avimake
RUNTIME DESTINATION bin)
install(TARGETS mjpegavi
RUNTIME DESTINATION lib)
install(FILES "${SOURCE_DIR}/avi.h"
DESTINATION include)