Use spaces instead of tabs in CMake module for consistency.
GitOrigin-RevId: 39fc482b99cb70235b10624bed6adb9a75752020
This commit is contained in:
parent
ba948f8661
commit
162b87e1a8
@ -1,47 +1,47 @@
|
||||
function(get_relative_link REL PATH)
|
||||
get_filename_component(NAME ${PATH} NAME_WE)
|
||||
if(${NAME} MATCHES "^lib")
|
||||
string(REGEX REPLACE "^lib" "-l" LINK ${NAME})
|
||||
elseif(${NAME} MATCHES "^-")
|
||||
set(LINK ${NAME})
|
||||
else()
|
||||
string(CONCAT LINK "-l" ${NAME})
|
||||
endif()
|
||||
set(${REL} ${LINK} PARENT_SCOPE)
|
||||
get_filename_component(NAME ${PATH} NAME_WE)
|
||||
if(${NAME} MATCHES "^lib")
|
||||
string(REGEX REPLACE "^lib" "-l" LINK ${NAME})
|
||||
elseif(${NAME} MATCHES "^-")
|
||||
set(LINK ${NAME})
|
||||
else()
|
||||
string(CONCAT LINK "-l" ${NAME})
|
||||
endif()
|
||||
set(${REL} ${LINK} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(generate_pkgconfig TARGET DESCRIPTION)
|
||||
message("generating pkg-config for ${TARGET}")
|
||||
get_filename_component(PREFIX ${CMAKE_INSTALL_PREFIX} ABSOLUTE)
|
||||
# message("Generating pkg-config for ${TARGET}")
|
||||
get_filename_component(PREFIX ${CMAKE_INSTALL_PREFIX} ABSOLUTE)
|
||||
|
||||
get_target_property(LIST ${TARGET} LINK_LIBRARIES)
|
||||
set(REQS "")
|
||||
set(LIBS "")
|
||||
foreach(LIB ${LIST})
|
||||
if(TARGET ${LIB})
|
||||
set(HAS_REQS 1)
|
||||
list(APPEND REQS ${LIB})
|
||||
else()
|
||||
set(HAS_LIBS 1)
|
||||
get_relative_link(LINK ${LIB})
|
||||
list(APPEND LIBS ${LINK})
|
||||
endif()
|
||||
endforeach()
|
||||
get_target_property(LIST ${TARGET} LINK_LIBRARIES)
|
||||
set(REQS "")
|
||||
set(LIBS "")
|
||||
foreach(LIB ${LIST})
|
||||
if(TARGET ${LIB})
|
||||
set(HAS_REQS 1)
|
||||
list(APPEND REQS ${LIB})
|
||||
else()
|
||||
set(HAS_LIBS 1)
|
||||
get_relative_link(LINK ${LIB})
|
||||
list(APPEND LIBS ${LINK})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(HAS_REQS)
|
||||
set(REQUIRES "\nRequires.private:")
|
||||
foreach (REQ ${REQS})
|
||||
string(APPEND REQUIRES " ${REQ}")
|
||||
endforeach()
|
||||
endif()
|
||||
if(HAS_LIBS)
|
||||
set(LIBRARIES "\nLibs.private:")
|
||||
foreach (LIB ${LIBS})
|
||||
string(APPEND LIBRARIES " ${LIB}")
|
||||
endforeach()
|
||||
endif()
|
||||
if(HAS_REQS)
|
||||
set(REQUIRES "\nRequires.private:")
|
||||
foreach (REQ ${REQS})
|
||||
string(APPEND REQUIRES " ${REQ}")
|
||||
endforeach()
|
||||
endif()
|
||||
if(HAS_LIBS)
|
||||
set(LIBRARIES "\nLibs.private:")
|
||||
foreach (LIB ${LIBS})
|
||||
string(APPEND LIBRARIES " ${LIB}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/${TARGET}.pc" CONTENT
|
||||
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/${TARGET}.pc" CONTENT
|
||||
"prefix=${PREFIX}
|
||||
includedir=\${prefix}/include
|
||||
libdir=\${prefix}/lib
|
||||
@ -53,5 +53,5 @@ Version: ${PROJECT_VERSION}
|
||||
CFlags: -I\${includedir}
|
||||
Libs: -L\${libdir} -l${TARGET}${REQUIRES}${LIBRARIES}")
|
||||
|
||||
install(FILES "pkgconfig/${TARGET}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
install(FILES "pkgconfig/${TARGET}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user