feat:build
parent
877157a0d9
commit
eb5d0b2218
|
@ -1,2 +1,3 @@
|
|||
build
|
||||
bazel-*
|
||||
/scripts/abseil-cpp/
|
||||
|
|
|
@ -29,6 +29,8 @@ include("${PROJECT_SOURCE_DIR}/cmake/functions.cmake")
|
|||
google_initialize_cartographer_project()
|
||||
google_enable_testing()
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "/usr/local/stow/absl")
|
||||
|
||||
find_package(absl REQUIRED)
|
||||
set(BOOST_COMPONENTS iostreams)
|
||||
if(WIN32)
|
||||
|
@ -268,6 +270,41 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
|||
${PROTOBUF_INCLUDE_DIR})
|
||||
# TODO(hrapp): This should not explicitly list pthread and use
|
||||
# PROTOBUF_LIBRARIES, but that failed on first try.
|
||||
|
||||
# 函数来递归查找库文件路径
|
||||
function(get_library_paths target)
|
||||
get_target_property(LINK_LIBS ${target} INTERFACE_LINK_LIBRARIES)
|
||||
if(NOT LINK_LIBS)
|
||||
message(WARNING "Target ${target} has no INTERFACE_LINK_LIBRARIES")
|
||||
return()
|
||||
endif()
|
||||
foreach(lib IN LISTS LINK_LIBS)
|
||||
if(TARGET ${lib})
|
||||
get_target_property(TYPE ${lib} TYPE)
|
||||
if(TYPE STREQUAL "INTERFACE_LIBRARY")
|
||||
get_library_paths(${lib})
|
||||
elseif(TYPE STREQUAL "STATIC_LIBRARY" OR TYPE STREQUAL "SHARED_LIBRARY" OR TYPE STREQUAL "MODULE_LIBRARY")
|
||||
get_target_property(LIB_PATH ${lib} LOCATION)
|
||||
if(LIB_PATH)
|
||||
message(STATUS "Library ${lib} is located at ${LIB_PATH}")
|
||||
else()
|
||||
message(WARNING "Library ${lib} has no LOCATION property")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if("${lib}" MATCHES "-NOTFOUND$")
|
||||
message(WARNING "Library ${lib} is NOTFOUND")
|
||||
else()
|
||||
message(STATUS "Linked library: ${lib}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
||||
# 获取absl::base目标的实际库文件路径
|
||||
get_library_paths(absl::base)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY}
|
||||
absl::algorithm
|
||||
absl::base
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
|
||||
<depend>libboost-iostreams-dev</depend>
|
||||
<depend>eigen</depend>
|
||||
<depend>libabsl-dev</depend>
|
||||
<depend>libcairo2-dev</depend>
|
||||
<depend>libceres-dev</depend>
|
||||
<depend>libgflags-dev</depend>
|
||||
|
|
Loading…
Reference in New Issue