blob: 9b3c053871b534bc3d2aa979042efba6463fe3cd (
plain) (
blame)
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
|
function(get_compile_flags _compile_flags)
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
set(compile_flags ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${build_type}})
# Get flags set by target_compile_options().
get_target_property(opt main_lib INTERFACE_COMPILE_OPTIONS)
if(opt)
list(APPEND compile_flags ${opt})
endif()
get_target_property(opt nvim COMPILE_OPTIONS)
if(opt)
list(APPEND compile_flags ${opt})
endif()
# Get flags set by target_compile_definitions().
get_target_property(defs main_lib INTERFACE_COMPILE_DEFINITIONS)
if(defs)
foreach(def ${defs})
list(APPEND compile_flags "-D${def}")
endforeach()
endif()
get_target_property(defs nvim COMPILE_DEFINITIONS)
if(defs)
foreach(def ${defs})
list(APPEND compile_flags "-D${def}")
endforeach()
endif()
# Get include directories.
get_target_property(dirs main_lib INTERFACE_INCLUDE_DIRECTORIES)
if(dirs)
foreach(dir ${dirs})
list(APPEND compile_flags "-I${dir}")
endforeach()
endif()
get_target_property(dirs main_lib INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
if(dirs)
foreach(dir ${dirs})
list(APPEND compile_flags "-I${dir}")
endforeach()
endif()
get_target_property(dirs nvim INCLUDE_DIRECTORIES)
if(dirs)
foreach(dir ${dirs})
list(APPEND compile_flags "-I${dir}")
endforeach()
endif()
list(REMOVE_DUPLICATES compile_flags)
string(REPLACE ";" " " compile_flags "${compile_flags}")
set(${_compile_flags} "${compile_flags}" PARENT_SCOPE)
endfunction()
|