You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.5 KiB

  1. --- a/CMakeLists.txt
  2. +++ b/CMakeLists.txt
  3. @@ -115,14 +115,26 @@ install(FILES AUTHORS COPYING ChangeLog
  4. # Ensure the file gets CRLF line endings on Windows.
  5. file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/stubby.yml INPUT ${CMAKE_CURRENT_SOURCE_DIR}/stubby.yml.example)
  6. -# Copy to destination iff no destination file exists.
  7. +
  8. +# Copy stubby.yml to destination iff no destination file exists.
  9. +# This is complicated by (a) not being able to use generators, due to
  10. +# CMake minimum version requirement, and (b) to account for DESTDIR.
  11. +# And in the latter case, if we're adding DESTDIR to the start of the
  12. +# path, we must on Windows remove any initial drive letter. That's what
  13. +# INSTALL appears to do.
  14. install(CODE "\
  15. - set(targetdir ${STUBBYCONFDIR})\n\
  16. - if (\$ENV{DESTDIR})\n\
  17. - set(targetdir \$ENV{DESTDIR}/\${targetdir})\n\
  18. + set(targetdir \"${STUBBYCONFDIR}\")\n\
  19. + set(destdir \"\$ENV{DESTDIR}\")\n\
  20. + if (destdir)\n\
  21. + string(REGEX REPLACE \"^([A-Z]:)?/(.*)\" \"\\\\2\" newtarget \"\${targetdir}\")\n\
  22. + if (newtarget)\n\
  23. + set(targetdir \"\${newtarget}\")\n\
  24. + endif ()\n\
  25. + set(targetdir \"\${destdir}/\${newtarget}\")\n\
  26. endif ()\n\
  27. - if (NOT EXISTS \${targetdir}/stubby.yml)\n\
  28. - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/stubby.yml DESTINATION \${targetdir})\n\
  29. + if (NOT EXISTS \"\${targetdir}/stubby.yml\")\n\
  30. + file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/stubby.yml\" DESTINATION \"\${targetdir}\")\n\
  31. + message(\"-- Installing: \${targetdir}/stubby.yml\")\n\
  32. endif ()")
  33. if (APPLE)