-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
48 lines (37 loc) · 1.14 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
cmake_minimum_required(VERSION 3.19)
project(CAPI LANGUAGES C CXX VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
function(GroupSourcesByFolder target)
set(SOURCE_GROUP_DELIMITER "/")
set(last_dir "")
set(files "")
get_target_property(sources ${target} SOURCES)
foreach(file ${sources})
file(RELATIVE_PATH relative_file "${CMAKE_CURRENT_SOURCE_DIR}" ${file})
get_filename_component(dir "${relative_file}" PATH)
if(NOT "${dir}" STREQUAL "${last_dir}")
if(files)
source_group("${last_dir}" FILES ${files})
endif()
set(files "")
endif()
set(files ${files} ${file})
set(last_dir "${dir}")
endforeach()
if(files)
source_group("${last_dir}" FILES ${files})
endif()
endfunction()
add_subdirectory(sdk)
file(GLOB_RECURSE CAPI_FILES
"include/*.h"
"src/*.hpp"
"src/*.cpp"
)
add_definitions(-DCAPI_COMPONENT_BUILD)
add_library(${PROJECT_NAME} SHARED ${CAPI_FILES})
GroupSourcesByFolder(${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PRIVATE
OMP-SDK
)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "$")