Re: [CMake] Packaging DEB at different directory with CPack

2012-01-24 Thread Damián Nohales
Many thanks Eric! your explanation really helps me!

El 24/01/12 04:21, Eric Noulard escribió:
 2012/1/24 Damián Nohales damiannoha...@gmail.com:
 Hello,

 I'm doing an application for Debian based systems and I need to package
 a .deb file, my application has several files to install in addition to
 the main executable.

 So, my CMakeLists.txt file looks like:

 
 project(myapp C)
 cmake_minimum_required(VERSION 2.8)

 # The executable
 add_executable(myapp main.c)
 install(TARGETS myapp RUNTIME DESTINATION bin)
 
 this is ok.
 

 # Another file to install
 install(FILES ${CMAKE_SOURCE_DIR}/data/myapp.desktop DESTINATION
 ${CMAKE_INSTALL_PREFIX}/share/applications)
 
 This is usually wrong as it is an absolute PATH destination
 why don't you simply specify
 install(FILES ${CMAKE_SOURCE_DIR}/data/myapp.desktop DESTINATION
  share/applications)
 
 SET(CPACK_GENERATOR DEB)
 SET(CPACK_DEBIAN_PACKAGE_MAINTAINER Damián Nohales)

 INCLUDE(CPack)
 

 I execute CMake and build the package in this way:

 
 $ cd build
 $ cmake -DCMAKE_INSTALL_PREFIX=install ..
 
 Specifying CMAKE_INSTALL_PREFIX has no effect on the following CPack call
 
 $ make package
 

 I need to specify a prefix for the installation because I want to test
 the application without installing on my whole system.
 
 Then you should override CPACK_PACKAGING_INSTALL_PREFIX
 
 $ cd build
 $ cpack -D CPACK_PACKAGING_INSTALL_PREFIX=$HOME/testinstall -G DEB
 
 another possibility is to install you deb content at an alternate location
 using
 
 dpkg --instdir=$HOME/testinstall -i your.deb
 
 
 But the .deb content resulting of executing make package is not what I
 expected:

 
 [...]
 

 Well, I'm sure you are understanding the problem, I'm expecting that the
 generated .deb package to has the files under the /usr directory having
 too the myapp.desktop file under the following filename
 /usr/share/applications/myapp.desktop.

 Any suggestion?
 
 Always use relative DESTINATION install path unless you forcibly want
 an ABSOLUTE destination.
 
--

Powered by www.kitware.com

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

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

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


[CMake] Packaging DEB at different directory with CPack

2012-01-23 Thread Damián Nohales
Hello,

I'm doing an application for Debian based systems and I need to package
a .deb file, my application has several files to install in addition to
the main executable.

So, my CMakeLists.txt file looks like:


project(myapp C)
cmake_minimum_required(VERSION 2.8)

# The executable
add_executable(myapp main.c)
install(TARGETS myapp RUNTIME DESTINATION bin)

# Another file to install
install(FILES ${CMAKE_SOURCE_DIR}/data/myapp.desktop DESTINATION
${CMAKE_INSTALL_PREFIX}/share/applications)

SET(CPACK_GENERATOR DEB)
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER Damián Nohales)

INCLUDE(CPack)


I execute CMake and build the package in this way:


$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=install ..
$ make package


I need to specify a prefix for the installation because I want to test
the application without installing on my whole system.

But the .deb content resulting of executing make package is not what I
expected:


DEBIAN
home
  user
projects
  myapp
build
  install
share
  applications
myapp.desktop
usr
  bin
myapp


(Note that I'm developing my application on the following directory:
/home/user/projects/myapp)

Well, I'm sure you are understanding the problem, I'm expecting that the
generated .deb package to has the files under the /usr directory having
too the myapp.desktop file under the following filename
/usr/share/applications/myapp.desktop.


Any suggestion?
Thanks in advance!
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Packaging DEB at different directory with CPack

2012-01-23 Thread Eric Noulard
2012/1/24 Damián Nohales damiannoha...@gmail.com:
 Hello,

 I'm doing an application for Debian based systems and I need to package
 a .deb file, my application has several files to install in addition to
 the main executable.

 So, my CMakeLists.txt file looks like:

 
 project(myapp C)
 cmake_minimum_required(VERSION 2.8)

 # The executable
 add_executable(myapp main.c)
 install(TARGETS myapp RUNTIME DESTINATION bin)

this is ok.


 # Another file to install
 install(FILES ${CMAKE_SOURCE_DIR}/data/myapp.desktop DESTINATION
 ${CMAKE_INSTALL_PREFIX}/share/applications)

This is usually wrong as it is an absolute PATH destination
why don't you simply specify
install(FILES ${CMAKE_SOURCE_DIR}/data/myapp.desktop DESTINATION
 share/applications)

 SET(CPACK_GENERATOR DEB)
 SET(CPACK_DEBIAN_PACKAGE_MAINTAINER Damián Nohales)

 INCLUDE(CPack)
 

 I execute CMake and build the package in this way:

 
 $ cd build
 $ cmake -DCMAKE_INSTALL_PREFIX=install ..

Specifying CMAKE_INSTALL_PREFIX has no effect on the following CPack call

 $ make package
 

 I need to specify a prefix for the installation because I want to test
 the application without installing on my whole system.

Then you should override CPACK_PACKAGING_INSTALL_PREFIX

$ cd build
$ cpack -D CPACK_PACKAGING_INSTALL_PREFIX=$HOME/testinstall -G DEB

another possibility is to install you deb content at an alternate location
using

dpkg --instdir=$HOME/testinstall -i your.deb


 But the .deb content resulting of executing make package is not what I
 expected:


[...]


 Well, I'm sure you are understanding the problem, I'm expecting that the
 generated .deb package to has the files under the /usr directory having
 too the myapp.desktop file under the following filename
 /usr/share/applications/myapp.desktop.

 Any suggestion?

Always use relative DESTINATION install path unless you forcibly want
an ABSOLUTE destination.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--

Powered by www.kitware.com

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

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

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