diff --git a/cmake/symlink_install/catkin_symlink_install.cmake.in b/cmake/symlink_install/catkin_symlink_install.cmake.in index 34fe51ecd..a246bc28a 100644 --- a/cmake/symlink_install/catkin_symlink_install.cmake.in +++ b/cmake/symlink_install/catkin_symlink_install.cmake.in @@ -227,6 +227,10 @@ function(catkin_symlink_install_targets) "unused/unsupported arguments: ${ARG_UNPARSED_ARGUMENTS}") endif() + list(REVERSE ARG_TARGET_FILES) + list(REMOVE_DUPLICATES ARG_TARGET_FILES) + list(REVERSE ARG_TARGET_FILES) + # iterate over target files foreach(file ${ARG_TARGET_FILES}) if(NOT IS_ABSOLUTE "${file}") @@ -239,7 +243,7 @@ function(catkin_symlink_install_targets) get_filename_component(fileext "${file}" EXT) if(fileext STREQUAL ".a" OR fileext STREQUAL ".lib") set(destination "${ARG_ARCHIVE_DESTINATION}") - elseif(fileext STREQUAL ".dylib" OR fileext MATCHES "\\.so(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?$") + elseif(fileext MATCHES "(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?\\.dylib$" OR fileext MATCHES "\\.so(\\.[0-9]+)?(\\.[0-9]+)?(\\.[0-9]+)?$") set(destination "${ARG_LIBRARY_DESTINATION}") elseif(fileext STREQUAL "" OR fileext STREQUAL ".dll" OR fileext STREQUAL ".exe") set(destination "${ARG_RUNTIME_DESTINATION}") diff --git a/cmake/symlink_install/catkin_symlink_install_files.cmake b/cmake/symlink_install/catkin_symlink_install_files.cmake index f4bab3e53..13b824fff 100644 --- a/cmake/symlink_install/catkin_symlink_install_files.cmake +++ b/cmake/symlink_install/catkin_symlink_install_files.cmake @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +set(__CATKIN_SYMLINK_INSTALL_FILES_INDEX "0" + CACHE INTERNAL "Index for unique symlink install files") + # # Reimplement CMake install(FILES) command to use symlinks instead of copying # resources. @@ -42,8 +45,22 @@ function(catkin_symlink_install_files files_keyword) if(index EQUAL -1) string(REPLACE ";" "\" \"" argn_quoted "\"${ARGN}\"") + + # generate unique files + set(generated_file_base + "${CMAKE_CURRENT_BINARY_DIR}/catkin_symlink_install_files_${__CATKIN_SYMLINK_INSTALL_FILES_INDEX}") + set(generated_file_generator_suffix "${generated_file_base}_$.cmake") + set(generated_file_variable_suffix "${generated_file_base}_\${CMAKE_INSTALL_CONFIG_NAME}.cmake") + math(EXPR __CATKIN_SYMLINK_INSTALL_FILES_INDEX + "${__CATKIN_SYMLINK_INSTALL_FILES_INDEX} + 1") + set(__CATKIN_SYMLINK_INSTALL_FILES_INDEX "${__CATKIN_SYMLINK_INSTALL_FILES_INDEX}" + CACHE INTERNAL "Index for unique symlink install files") + + file(GENERATE OUTPUT "${generated_file_generator_suffix}" + CONTENT + "catkin_symlink_install_files(CURRENT_SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\" FILES ${argn_quoted})\n") catkin_symlink_install_append_install_code( - "catkin_symlink_install_files(CURRENT_SOURCE_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\" FILES ${argn_quoted})" + "include(\"${generated_file_variable_suffix}\")" COMMENTS "install(FILES ${argn_quoted})" ) endif() diff --git a/cmake/symlink_install/catkin_symlink_install_targets.cmake b/cmake/symlink_install/catkin_symlink_install_targets.cmake index 32ae5a9e7..7367088bf 100644 --- a/cmake/symlink_install/catkin_symlink_install_targets.cmake +++ b/cmake/symlink_install/catkin_symlink_install_targets.cmake @@ -73,11 +73,12 @@ function(catkin_symlink_install_targets) "'${target}' is an imported target") endif() list(APPEND target_files "$") - if(WIN32) - get_target_property(target_type "${target}" TYPE) - if("${target_type}" STREQUAL "SHARED_LIBRARY") - list(APPEND target_files "$") + get_target_property(target_type "${target}" TYPE) + if("${target_type}" STREQUAL "SHARED_LIBRARY") + if(NOT WIN32) + list(APPEND target_files "$") endif() + list(APPEND target_files "$") endif() endforeach()