-
-
Notifications
You must be signed in to change notification settings - Fork 402
/
Copy pathHelperMacros.cmake
35 lines (32 loc) · 981 Bytes
/
HelperMacros.cmake
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
macro(addIndent text)
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
list(APPEND CMAKE_MESSAGE_INDENT ${text})
endif()
endmacro()
macro(removeIndent)
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
list(POP_BACK CMAKE_MESSAGE_INDENT)
endif()
endmacro()
# Macro to get path of first sub dir of a dir, used for MAC OSX lib/header searching
macro(FIRSTSUBDIR result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
list(APPEND dirlist "${curdir}/${child}")
break()
endif()
endforeach()
set(${result} ${dirlist})
endmacro()
macro(getTargetImportedLocation result target)
if(TARGET ${target})
foreach(prop IMPORTED_LOCATION IMPORTED_LOCATION_NOCONFIG IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE)
get_target_property (${result} ${target} ${prop})
if(NOT ("${${result}}" STREQUAL "${result}-NOTFOUND"))
break()
endif()
endforeach()
endif()
endmacro()