mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-21 22:25:06 +00:00
Fix generate pkg config
This commit is contained in:
parent
397f383c53
commit
b7aa06157b
@ -1,5 +1,5 @@
|
||||
function(GeneratePkgConfigFile target description)
|
||||
cmake_parse_arguments(pc "" "NAME;REQUIRES;LIBRARY_DIR" "" ${ARGV})
|
||||
cmake_parse_arguments(pc "" "NAME;LIBRARY_DIR" "REQUIRES" ${ARGV})
|
||||
if(NOT pc_LIBRARY_DIR)
|
||||
set(pc_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
@ -31,8 +31,11 @@ function(GeneratePkgConfigFile target description)
|
||||
if(link MATCHES "-l")
|
||||
list(APPEND links ${link})
|
||||
elseif(TARGET ${link})
|
||||
get_property(link_target TARGET ${link} PROPERTY OUTPUT_NAME)
|
||||
list(APPEND links ${link_target})
|
||||
get_property(is_imported TARGET ${link} PROPERTY IMPORTED)
|
||||
if(NOT is_imported)
|
||||
get_property(link_target TARGET ${link} PROPERTY OUTPUT_NAME)
|
||||
list(APPEND links ${link_target})
|
||||
endif()
|
||||
else()
|
||||
list(APPEND links "-l${link}")
|
||||
endif()
|
||||
@ -52,7 +55,8 @@ function(GeneratePkgConfigFile target description)
|
||||
file(APPEND ${out_file} "Cflags: -I\${includedir} ${definitions}\n")
|
||||
file(APPEND ${out_file} "Libs: -L\${libdir} ${links}\n")
|
||||
if(pc_REQUIRES)
|
||||
file(APPEND ${out_file} "Requires: ${pc_REQUIRES}")
|
||||
string(REPLACE ";" " " REQUIRES "${pc_REQUIRES}")
|
||||
file(APPEND ${out_file} "Requires: ${REQUIRES}")
|
||||
endif()
|
||||
install(FILES ${out_file} DESTINATION "${PKGCONFIG_INSTALL_DIR}")
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user