-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathFindMrtPCL.cmake
61 lines (54 loc) · 1.88 KB
/
FindMrtPCL.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# protect agains multiple inclusion
if(TARGET mrt_pcl::pcl)
return()
endif()
cmake_policy(PUSH)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# find package component
if(Mrtpcl_FIND_REQUIRED)
find_package(PCL QUIET REQUIRED)
elseif(Mrtpcl_FIND_QUIETLY)
find_package(PCL QUIET)
else()
find_package(PCL QUIET)
endif()
add_library(mrt_pcl::pcl INTERFACE IMPORTED)
# Copied from FindAutoDeps.cmake
function(_cleanup_libraries var_name_libs)
# replace "debug", "general" and "optimized" keywords in the libraries list with generator expressions
list(LENGTH ${var_name_libs} size)
foreach(idx RANGE ${size})
if(${idx} EQUAL ${size})
continue()
endif()
list(GET ${var_name_libs} ${idx} statement)
if(${statement} STREQUAL "debug")
math(EXPR next ${idx}+1)
list(GET ${var_name_libs} ${next} lib)
list(REMOVE_AT ${var_name_libs} ${next})
list(INSERT ${var_name_libs} ${next} "$<$<CONFIG:DEBUG>:${lib}>")
elseif(${statement} STREQUAL "optimized")
math(EXPR next ${idx}+1)
list(GET ${var_name_libs} ${next} lib)
list(REMOVE_AT ${var_name_libs} ${next})
list(INSERT ${var_name_libs} ${next} "$<$<NOT:$<CONFIG:DEBUG>>:${lib}>")
endif()
endforeach()
if(size)
list(REMOVE_ITEM ${var_name_libs} debug optimized general)
endif()
set(${var_name_libs}
${${var_name_libs}}
PARENT_SCOPE)
endfunction()
_cleanup_libraries(PCL_LIBRARIES)
# Add PCL_NO_PRECOMPILE as this resolves Eigen issues.
set_target_properties(
mrt_pcl::pcl
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${PCL_INCLUDE_DIRS}"
INTERFACE_LINK_DIRECTORIES "${PCL_LIBRARY_DIRS}"
INTERFACE_LINK_LIBRARIES "${PCL_LIBRARIES}"
INTERFACE_COMPILE_DEFINITIONS "PCL_NO_PRECOMPILE")
cmake_policy(POP)