-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
34 lines (26 loc) · 1.03 KB
/
Copy pathCMakeLists.txt
File metadata and controls
34 lines (26 loc) · 1.03 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
cmake_minimum_required(VERSION 3.15)
project(library VERSION 1.0.0 LANGUAGES C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
include(GenerateExportHeader)
function(add_stb_library name macro_prefix)
# INTERFACE TARGET for C/C++ (.h)
add_library(${name}_interface INTERFACE)
target_include_directories(${name}_interface INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
# SHARED TARGET for other languages (.dll)
add_library(${name}_shared SHARED src/${name}.c)
target_link_libraries(${name}_shared PRIVATE ${name}_interface)
generate_export_header(${name}_shared)
target_include_directories(${name}_shared PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_compile_definitions(${name}_shared PRIVATE BUILDING_${macro_prefix}_DLL)
set_target_properties(${name}_shared PROPERTIES OUTPUT_NAME "_${name}")
endfunction()
add_stb_library(inc_nn NN)
add_stb_library(inc_sr SR)
add_stb_library(inc_ft FT)
enable_testing()
add_subdirectory(tests)