Skip to content

Commit b4f7360

Browse files
committed
.) initialize CMAKE_INSTALL_PREFIX after CPACK_PACKAGE_NAME has been initialized
.) a cache variable will/can always be overwritten by command-line or cache settings .) use CMAKE_INSTALL_PREFIX instead of hardcoded '/opt/domiticz'
1 parent 6cb767b commit b4f7360

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

CMakeLists.txt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,18 +501,6 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
501501
ENDIF(USE_STATIC_LIBSTDCXX)
502502
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
503503

504-
# If it wasn't overridden from command line / cache.
505-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
506-
set(CMAKE_INSTALL_PREFIX "/opt/${CPACK_PACKAGE_NAME}" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
507-
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
508-
509-
install(TARGETS domoticz DESTINATION /opt/domoticz)
510-
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/www DESTINATION /opt/domoticz USE_SOURCE_PERMISSIONS)
511-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/License.txt DESTINATION /opt/domoticz)
512-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/History.txt DESTINATION /opt/domoticz)
513-
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts DESTINATION /opt/domoticz USE_SOURCE_PERMISSIONS)
514-
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Config DESTINATION /opt/domoticz USE_SOURCE_PERMISSIONS)
515-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/updatedomo DESTINATION /opt/domoticz PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
516504

517505
# build a CPack driven installer package
518506
INCLUDE(InstallRequiredSystemLibraries)
@@ -542,6 +530,16 @@ SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
542530

543531
INCLUDE(CPack)
544532

533+
set(CMAKE_INSTALL_PREFIX "/opt/${CPACK_PACKAGE_NAME}" CACHE PATH "Install path prefix, prepended onto install directories.")
534+
535+
install(TARGETS domoticz DESTINATION ${CMAKE_INSTALL_PREFIX})
536+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/www DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS)
537+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/License.txt DESTINATION ${CMAKE_INSTALL_PREFIX})
538+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/History.txt DESTINATION ${CMAKE_INSTALL_PREFIX})
539+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS)
540+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Config DESTINATION ${CMAKE_INSTALL_PREFIX} USE_SOURCE_PERMISSIONS)
541+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/updatedomo DESTINATION ${CMAKE_INSTALL_PREFIX} PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
542+
545543
INCLUDE(TestBigEndian)
546544

547545
TEST_BIG_ENDIAN(BIGENDIAN)

0 commit comments

Comments
 (0)