@@ -25,7 +25,7 @@ pkgconfig_generate_pc(
2525)
2626```
2727
28- Generate pkgconfig `<pc-file-output>` from the given pc `<pc-template-file>`
28+ Generate pkg-config `<pc-file-output>` from the given pc `<pc-template-file>`
2929template.
3030
3131* `TARGET`
@@ -72,20 +72,20 @@ function(_pkgconfig_parse_variables variables)
7272 )
7373 endif ()
7474
75- set (is_value FALSE )
76- set (variables_options "" )
77- set (result_variables "" )
78- set (result_values "" )
75+ set (isValue FALSE )
76+ set (variablesOptions "" )
77+ set (resultVariables "" )
78+ set (resultValues "" )
7979 foreach (variable IN LISTS variables )
80- if (is_value )
81- set (is_value FALSE )
80+ if (isValue )
81+ set (isValue FALSE )
8282 continue ()
8383 endif ()
8484 list (POP_FRONT variables var value )
8585
86- list (APPEND result_variables ${var} )
86+ list (APPEND resultVariables ${var} )
8787
88- # The result_values are for the install(CODE) and generator expression
88+ # The resultValues are for the install(CODE) and generator expression
8989 # $<INSTALL_PREFIX> works since CMake 3.27, for earlier versions the escaped
9090 # variable CMAKE_INSTALL_PREFIX can be used.
9191 if (
@@ -96,16 +96,16 @@ function(_pkgconfig_parse_variables variables)
9696 REPLACE
9797 "$<INSTALL_PREFIX>"
9898 "\$ {CMAKE_INSTALL_PREFIX}"
99- replaced_value
99+ replacedValue
100100 "${value} "
101101 )
102- list (APPEND result_values "${replaced_value } " )
102+ list (APPEND resultValues "${replacedValue } " )
103103 else ()
104- list (APPEND result_values "${value} " )
104+ list (APPEND resultValues "${value} " )
105105 endif ()
106106
107107 # Replace possible INSTALL_PREFIX in value for usage in add_custom_command,
108- # in the result_values above the intact genex is left for enabling the
108+ # in the resultValues above the intact genex is left for enabling the
109109 # possible 'cmake --install --prefix ...' override.
110110 if (value MATCHES [[.*\$<INSTALL_PREFIX>.*]])
111111 string (
@@ -117,14 +117,14 @@ function(_pkgconfig_parse_variables variables)
117117 )
118118 endif ()
119119
120- list (APPEND variables_options -D ${var} ="${value} " )
120+ list (APPEND variablesOptions -D ${var} ="${value} " )
121121
122- set (is_value TRUE )
122+ set (isValue TRUE )
123123 endforeach ()
124124
125- set (variables_options "${variables_options } " PARENT_SCOPE)
126- set (result_variables "${result_variables } " PARENT_SCOPE)
127- set (result_values "${result_values } " PARENT_SCOPE)
125+ set (variablesOptions "${variablesOptions } " PARENT_SCOPE)
126+ set (resultVariables "${resultVariables } " PARENT_SCOPE)
127+ set (resultValues "${resultValues } " PARENT_SCOPE)
128128endfunction ()
129129
130130function (pkgconfig_generate_pc)
@@ -209,36 +209,41 @@ function(pkgconfig_generate_pc)
209209 )
210210
211211 if (parsed_TARGET)
212- set (target_option -D TARGET_FILE="$<TARGET_FILE:${parsed_TARGET} >" )
212+ set (targetOption -D TARGET_FILE="$<TARGET_FILE:${parsed_TARGET} >" )
213213 endif ()
214214
215215 if (parsed_VARIABLES)
216216 _pkgconfig_parse_variables("${parsed_VARIABLES} " )
217217 endif ()
218218
219- cmake_path(GET template FILENAME filename)
219+ cmake_path(
220+ RELATIVE_PATH
221+ output
222+ BASE_DIRECTORY ${CMAKE_BINARY_DIR}
223+ OUTPUT_VARIABLE outputRelativePath
224+ )
220225
221- string (MAKE_C_IDENTIFIER "${filename } " target_name )
226+ string (MAKE_C_IDENTIFIER "${outputRelativePath } " targetName )
222227
223228 add_custom_target (
224- pkgconfig_generate_ ${target_name }
229+ pkgconfig_ ${targetName }
225230 ALL
226231 COMMAND ${CMAKE_COMMAND}
227232 -D PKGCONFIG_OBJDUMP_EXECUTABLE=${PKGCONFIG_OBJDUMP_EXECUTABLE}
228233 -D TEMPLATE=${template}
229234 -D OUTPUT =${output}
230- ${target_option }
231- ${variables_options }
235+ ${targetOption }
236+ ${variablesOptions }
232237 -P CMakeFiles/PkgConfigGeneratePc.cmake
233- COMMENT "[PkgConfig] Generating pkg-config ${filename} file "
238+ COMMENT "[PkgConfig] Generating ${outputRelativePath} "
234239 )
235240
236241 install (CODE "
237242 block()
238- set(result_variables ${result_variables } )
239- set(result_values \" ${result_values } \" )
243+ set(resultVariables ${resultVariables } )
244+ set(resultValues \" ${resultValues } \" )
240245
241- foreach(var value IN ZIP_LISTS result_variables result_values )
246+ foreach(var value IN ZIP_LISTS resultVariables resultValues )
242247 set(\$ {var} \"\$ {value}\" )
243248 endforeach()
244249
0 commit comments