File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -142,12 +142,24 @@ macro(_ament_cmake_python_install_sources package_name)
142142 PATTERN "__pycache__" EXCLUDE
143143 )
144144 else ()
145- # we merge during build as cmake doesn't guarantee install sequence
146- install (
147- DIRECTORY "${_build_dir} /${package_name} /"
148- DESTINATION "${_DESTINATION} /${package_name} "
149- PATTERN "*.pyc" EXCLUDE
150- PATTERN "__pycache__" EXCLUDE
145+ # cmake does not support overwriting a more recently modified file
146+ # we must remove any existing files before installing the new package
147+ install (CODE
148+ "set(_dest \"\$ {CMAKE_INSTALL_PREFIX}/${_DESTINATION} /${package_name} \" )
149+ set(_dirs ${_DIRS_TO_INSTALL} )
150+ foreach(_dir IN LISTS _dirs)
151+ file(GLOB_RECURSE _rel_files RELATIVE \"\$ {_dir}\" \"\$ {_dir}/*\" )
152+ foreach(_file IN LISTS _rel_files)
153+ file(REMOVE \"\$ {_dest}/\$ {_file}\" )
154+ endforeach()
155+ file(INSTALL
156+ DESTINATION \"\$ {_dest}\"
157+ TYPE DIRECTORY
158+ FILES \"\$ {_dir}\"
159+ PATTERN \" *.pyc\" EXCLUDE
160+ PATTERN \" __pycache__\" EXCLUDE
161+ )
162+ endforeach()"
151163 )
152164 endif ()
153165endmacro ()
You can’t perform that action at this time.
0 commit comments