|
|
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -115,14 +115,26 @@ install(FILES AUTHORS COPYING ChangeLog
-
- # Ensure the file gets CRLF line endings on Windows.
- file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/stubby.yml INPUT ${CMAKE_CURRENT_SOURCE_DIR}/stubby.yml.example)
- -# Copy to destination iff no destination file exists.
- +
- +# Copy stubby.yml to destination iff no destination file exists.
- +# This is complicated by (a) not being able to use generators, due to
- +# CMake minimum version requirement, and (b) to account for DESTDIR.
- +# And in the latter case, if we're adding DESTDIR to the start of the
- +# path, we must on Windows remove any initial drive letter. That's what
- +# INSTALL appears to do.
- install(CODE "\
- - set(targetdir ${STUBBYCONFDIR})\n\
- - if (\$ENV{DESTDIR})\n\
- - set(targetdir \$ENV{DESTDIR}/\${targetdir})\n\
- + set(targetdir \"${STUBBYCONFDIR}\")\n\
- + set(destdir \"\$ENV{DESTDIR}\")\n\
- + if (destdir)\n\
- + string(REGEX REPLACE \"^([A-Z]:)?/(.*)\" \"\\\\2\" newtarget \"\${targetdir}\")\n\
- + if (newtarget)\n\
- + set(targetdir \"\${newtarget}\")\n\
- + endif ()\n\
- + set(targetdir \"\${destdir}/\${newtarget}\")\n\
- endif ()\n\
- - if (NOT EXISTS \${targetdir}/stubby.yml)\n\
- - file(COPY ${CMAKE_CURRENT_BINARY_DIR}/stubby.yml DESTINATION \${targetdir})\n\
- + if (NOT EXISTS \"\${targetdir}/stubby.yml\")\n\
- + file(COPY \"${CMAKE_CURRENT_BINARY_DIR}/stubby.yml\" DESTINATION \"\${targetdir}\")\n\
- + message(\"-- Installing: \${targetdir}/stubby.yml\")\n\
- endif ()")
-
- if (APPLE)
|