Fix installation of zm.conf.new instead of zm.conf

This commit is contained in:
Isaac Connor 2017-05-15 16:25:48 -04:00
parent 68aea50ca9
commit 74fd3d4c3b
1 changed files with 9 additions and 11 deletions

View File

@ -838,17 +838,15 @@ else(zmconfgen_result EQUAL 0)
endif(zmconfgen_result EQUAL 0)
# Install zm.conf
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
#install(CODE "
#if (NOT EXISTS \"${ZM_CONFIG_DIR}/zm.conf\")
#message(STATUS \"Installing zm.conf\")
#file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf\" DESTINATION \"${ZM_CONFIG_DIR}\")
#else (NOT EXISTS \"${ZM_CONFIG_DIR}/zm.conf\")
#message(STATUS \"Not overwriting zm.conf. Installing zm.conf.new instead.\")
#file(RENAME \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf\" \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new\")
#file(INSTALL \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new\" DESTINATION \"${ZM_CONFIG_DIR}\")
#file(RENAME \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new\" \"${CMAKE_CURRENT_BINARY_DIR}/zm.conf\")
#endif()
if (NOT EXISTS "${ZM_CONFIG_DIR}/zm.conf")
message(STATUS "No zm.conf at ${CMAKE_CURRENT_BINARY_DIR}/zm.conf. Will install a new zm.conf")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
else (NOT EXISTS "${ZM_CONFIG_DIR}/zm.conf")
message(STATUS "Found zm.conf at ${CMAKE_CURRENT_BINARY_DIR}/zm.conf. Not overwriting. Installing zm.conf.new instead.")
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" "${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new" DESTINATION "${ZM_CONFIG_DIR}")
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/zm.conf.new" "${CMAKE_CURRENT_BINARY_DIR}/zm.conf")
endif()
#")