Control install destination directory
authorRomain Forlot <romain.forlot@iot.bzh>
Wed, 4 Oct 2017 09:18:47 +0000 (11:18 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Wed, 4 Oct 2017 09:18:47 +0000 (11:18 +0200)
Either put all in a dedicated binding directory like a classic
widget install, either put all directly a CMAKE_INSTALL_PREFIX
root directory.

Change-Id: I54ebe8a680ea09af73c7fc9e6646fdd203fdeb98
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
cmake/cmake.d/03-macros.cmake

index fa4bd1f..6c87d95 100644 (file)
@@ -238,10 +238,18 @@ macro(project_targets_populate)
                COMMAND mkdir -p ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR})
        add_custom_target(populate DEPENDS ${PACKAGE_BINDIR} ${PACKAGE_ETCDIR} ${PACKAGE_LIBDIR} ${PACKAGE_HTTPDIR} ${PACKAGE_DATADIR})
 
+       # Dirty trick to define a default INSTALL command for app-templates handled
+       # targets
        INSTALL(CODE "execute_process(COMMAND make populate)")
-       INSTALL(DIRECTORY ${PROJECT_PKG_BUILD_DIR}/
-               DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}
-       )
+       if(NO_DEDICATED_INSTALL_DIR)
+               INSTALL(DIRECTORY ${PROJECT_PKG_BUILD_DIR}/
+                       DESTINATION ${CMAKE_INSTALL_PREFIX}
+               )
+       else()
+               INSTALL(DIRECTORY ${PROJECT_PKG_BUILD_DIR}/
+                       DESTINATION ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}
+               )
+       endif()
 
        get_property(PROJECT_TARGETS GLOBAL PROPERTY PROJECT_TARGETS)
        foreach(TARGET ${PROJECT_TARGETS})