productbuild: Installing to absolute system path or to user home path

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

productbuild: Installing to absolute system path or to user home path

Roman Wüger


Hello,

 

I tried to install a file/directory with productbuild on macOS which is generated with CPack.

The most of the files are installed correctly, but I have two problems:

 

  1. If I want to install to “/Library/Application\ Support/Adobe/Lightroom/Modules”
  2. If I want to install to the users modules folder “~/Library/Application\ Support/Adobe/Lightroom/Modules”

 

How can I archive these two?

 

I already tried the following with no luck:

install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin

                DESTINATION /Library/Application\ Support/Adobe/Lightroom/Modules)

 

install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin

                DESTINATION ~/Library/Application\ Support/Adobe/Lightroom/Modules)

 

Best Regards

Roman


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: [cmake-developers] productbuild: Installing to absolute system path or to user home path

CMake mailing list
According to the docs, the INSTALL command uses the absolute path if
it is given as the DESTINATION, so .... it should work.
https://cmake.org/cmake/help/latest/command/install.html

Did you try using a double quoted string, instead of escaping the
space with a backslash?

I think this should work for the absolute one:
INSTALL( ... DESTINATION "/abs/path/to/some folder")

For the one in the home directory, I'm not sure if a string that
starts with "~" is considered absolute or not, so it may or may not
end up where you expect it. Can you resolve it before hand with a
get_filename_component call, (or otherwise), and pass in a string that
begins with "/" ...?


Hope this helps,
David C.


On Mon, Oct 28, 2019 at 4:36 PM Roman Wüger <[hidden email]> wrote:

>
> 
>
> Hello,
>
>
>
> I tried to install a file/directory with productbuild on macOS which is generated with CPack
>
> The most of the files are installed correctly, but I have two problems:
>
>
>
> If I want to install to “/Library/Application\ Support/Adobe/Lightroom/Modules”
> If I want to install to the users modules folder “~/Library/Application\ Support/Adobe/Lightroom/Modules”
>
>
>
> How can I archive these two?
>
>
>
> I already tried the following with no luck:
>
> install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin
>
>                 DESTINATION /Library/Application\ Support/Adobe/Lightroom/Modules)
>
>
>
> install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin
>
>                 DESTINATION ~/Library/Application\ Support/Adobe/Lightroom/Modules)
>
>
>
> Best Regards
>
> Roman
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake-developers
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: [cmake-developers] productbuild: Installing to absolute system path or to user home path

Roman Wüger
In reply to this post by Roman Wüger
Hello,

The main wish is to install to the user directory as described in the documentation, the absolute path to the „all users“ works already:

Here is the description from the manual, also attached as an image

Automatic plug-in loading
Lightroom automatically checks for plug-ins in the standard Modules folder where other Lightroom settings are stored:
   In Mac OS (current user) In Mac OS (all users)
In Windows XP
plug-in and also installs a helper application.
Plug-ins that are installed in this location are automatically listed in the Plug-in Manager dialog. You can use the dialog to enable or disable such a plug-in, but not to remove it. The Remove button is dimmed when such a plug-in is selected.
~/Library/Application Support/Adobe/Lightroom/Modules /Library/Application Support/Adobe/Lightroom/Modules
C:\Documents and Users\username\Application Data\Adobe\Lightroom\Modules
C:\Users\username\AppData\Roaming\Adobe\Lightroom\Modules You may want to use this location if, for example, you are writing an installer that installs a Lightroom
   In Windows 7/Vista



Regards
Roman

Am 01.11.2019 um 05:10 schrieb David Aguilar <[hidden email]>:


I would also suggest avoiding absolute paths so that the user can tell you where to root the installation.

One way to do that is to use GNUInstallDirs so that the user can specify the install prefix.  And maybe you want to let them user their home directory be default if they've not specified it:


include(GNUInstallDirs)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    # NOTE: default to the home directory, assumes $HOME is defined in the environment
    set(CMAKE_INSTALL_PREFIX $ENV{HOME} CACHE PATH "Installation prefix" FORCE)
endif ()

[... usual stuff here ...]

# NOTE: relative path
install(TARGETS target_name DESTINATION "Library/Application Support/Adobe/Lightroom/Modules")


Then the user would just "make && make install" and it'll install to their ~/Library directory by default.

Then, if they have the permissions to do so, they can install to the global system location using:

cmake -D CMAKE_INSTALL_PREFIX=/ . &&
make &&
sudo make install

Mixing both in the same cmake invocation can be done, but now you've made it impossible to install into other locations (for testing, packaging, etc).

For example, someone might want to package it without sudo, so they might want to do this instead of "sudo make install":

    make DESTDIR=$PWD/tmp install

and then you have a tmp/Library/ directory structure that can be made into a macOS .pkg installer:

    pkgbuild --install-location / --identifier org.domain.pkgs.example --version 1.0.0 --root tmp example-1.0.0.pkg

And now you have a .pkg installer that updates the global /Library directory without needing to be root to build it.


Question -- is this a situation where you want a single build to install into both locations, or is the literally the same plugin and it only needs to be in one of the two locations (global vs. user)?  I interpreted your question to be about the latter, where the user really only needs one or the other, and it's the same plugin in both cases.

I don't know if cpack handles this for you, but hopefully this is helpful advice.


On Thu, Oct 31, 2019 at 10:19 AM David Cole via cmake-developers <[hidden email]> wrote:
According to the docs, the INSTALL command uses the absolute path if
it is given as the DESTINATION, so .... it should work.
https://cmake.org/cmake/help/latest/command/install.html

Did you try using a double quoted string, instead of escaping the
space with a backslash?

I think this should work for the absolute one:
INSTALL( ... DESTINATION "/abs/path/to/some folder")

For the one in the home directory, I'm not sure if a string that
starts with "~" is considered absolute or not, so it may or may not
end up where you expect it. Can you resolve it before hand with a
get_filename_component call, (or otherwise), and pass in a string that
begins with "/" ...?


Hope this helps,
David C.


On Mon, Oct 28, 2019 at 4:36 PM Roman Wüger <[hidden email]> wrote:
> Hello,
> I tried to install a file/directory with productbuild on macOS which is generated with CPack
> The most of the files are installed correctly, but I have two problems:
>
> If I want to install to “/Library/Application\ Support/Adobe/Lightroom/Modules”
> If I want to install to the users modules folder “~/Library/Application\ Support/Adobe/Lightroom/Modules”
>
> How can I archive these two?
>
> I already tried the following with no luck:
> install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin
>                 DESTINATION /Library/Application\ Support/Adobe/Lightroom/Modules)
>
> install(DIRECTORY $<TARGET_FILE_DIR:${PROJECT_NAME}>/${CMAKE_PROJECT_NAME}.lrplugin
>                 DESTINATION ~/Library/Application\ Support/Adobe/Lightroom/Modules)
> Best Regards
>
> Roman
--
David

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake