-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
57 lines (47 loc) · 1.27 KB
/
CMakeLists.txt
File metadata and controls
57 lines (47 loc) · 1.27 KB
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
cmake_minimum_required(VERSION 3.20)
project(wpasupplicant-cpp VERSION 1.0.0 LANGUAGES CXX)
# Set C++20 standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Build options
option(BUILD_TESTS "Build unit tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)
# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Library source files
set(LIB_SOURCES
src/wpasupplicant.cpp
)
# Create library
add_library(wpasupplicant SHARED ${LIB_SOURCES})
add_library(wpasupplicant::wpasupplicant ALIAS wpasupplicant)
# Set library properties
set_target_properties(wpasupplicant PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER include/wpasupplicant.hpp
)
# Install library
install(TARGETS wpasupplicant
EXPORT wpasupplicant-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include
)
# Install CMake config files
install(EXPORT wpasupplicant-targets
FILE wpasupplicant-targets.cmake
NAMESPACE wpasupplicant::
DESTINATION lib/cmake/wpasupplicant
)
# Build tests
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
# Build examples
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()