@@ -240,14 +240,6 @@ for pkg_xml in ${TEMP_DIR}/src/*/package.xml; do
240240 find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
241241 sed -i " s@\(gz_find_package\s*(\s*${PACKAGE} .*\)\sVERSION@\1@"
242242 # * Add "VERSION ${MAJOR_VERSION}" just after the ${PACKAGE} name to be found
243- # when the package name is at the end of line.
244- # For example, the following line:
245- # gz_find_package(gz-math
246- # is replaced with
247- # gz_find_package(gz-math VERSION 9
248- find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
249- sed -i " s@\(gz_find_package\s*(\s*${PACKAGE} \)\$ @\1 VERSION ${MAJOR_VERSION} @"
250- # * Add "VERSION ${MAJOR_VERSION}" just after the ${PACKAGE} name to be found
251243 # when there is whitespace or ')' after the package name.
252244 # For example, the following lines:
253245 # gz_find_package(gz-math)
@@ -257,6 +249,14 @@ for pkg_xml in ${TEMP_DIR}/src/*/package.xml; do
257249 # gz_find_package(gz-math VERSION 9 REQUIRED)
258250 find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
259251 sed -i " s@\(gz_find_package\s*(\s*${PACKAGE} \)\([ )]\)@\1 VERSION ${MAJOR_VERSION} \2@"
252+ # * Add "VERSION ${MAJOR_VERSION}" just after the ${PACKAGE} name to be found
253+ # when the package name is at the end of line. This must be done last.
254+ # For example, the following line:
255+ # gz_find_package(gz-math
256+ # is replaced with
257+ # gz_find_package(gz-math VERSION 9
258+ find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
259+ sed -i " s@\(gz_find_package\s*(\s*${PACKAGE} \)\$ @\1 VERSION ${MAJOR_VERSION} @"
260260
261261 # For find_package calls:
262262 # * If it has a string containing digits and '.' right after the package name
@@ -269,14 +269,6 @@ for pkg_xml in ${TEMP_DIR}/src/*/package.xml; do
269269 # find_package(gz-math REQUIRED)
270270 find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
271271 sed -i " s@^\(\s*find_package\s*(\s*${PACKAGE} \)\s\+[0-9\.]\+@\1@"
272- # * Add the major version after the package name to be found when the package
273- # name is at the end of line.
274- # For example, the following lines:
275- # find_package(gz-math
276- # is replaced with
277- # find_package(gz-math 9
278- find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
279- sed -i " s@^\(\s*find_package\s*(\s*${PACKAGE} \)\$ @\1 ${MAJOR_VERSION} @"
280272 # * Add the major version after the package name to be found when there
281273 # is whitespace or ')' after the package name.
282274 # For example, the following lines:
@@ -287,6 +279,14 @@ for pkg_xml in ${TEMP_DIR}/src/*/package.xml; do
287279 # find_package(gz-math 9 REQUIRED)
288280 find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
289281 sed -i " s@^\(\s*find_package\s*(\s*${PACKAGE} \)\([ )]\)@\1 ${MAJOR_VERSION} \2@"
282+ # * Add the major version after the package name to be found when the package
283+ # name is at the end of line. This must be done last.
284+ # For example, the following lines:
285+ # find_package(gz-math
286+ # is replaced with
287+ # find_package(gz-math 9
288+ find ${TEMP_DIR} /src/* /${cmake_txt_path} -type f -print0 | xargs -0 \
289+ sed -i " s@^\(\s*find_package\s*(\s*${PACKAGE} \)\$ @\1 ${MAJOR_VERSION} @"
290290 done
291291 popd > /dev/null
292292done
0 commit comments