[CMake] cmake package question

James C. Newell NewellJC at fairmountautomation.com
Mon Feb 4 14:55:01 EST 2008


Hello,

I am new to cmake but enjoying it greatly.

My question relates to the cpack feature.  I wasn't able to determine
from the documentation or wiki on how to have the package command only
include the file system from myproj-0.1.1-Linux and below. So, in the
example below instead of the .tar.gz containing
myproj-0.1.1-Linux/bin/myproj would contain /bin/myproj.  I'm sure I
missed something in the documentation but would greatly appreciate any
advice.

Thanks You,
Jim Newell


CMakeList.txt file:
project(myproj)

add_executable(myproj myproj.c)

install(TARGETS myproj RUNTIME DESTINATION bin)

set(CPACK_GENERATOR "TGZ")
include(CPack)
EOF

Produces the following:

$ make package
[100%] Building C object CMakeFiles/myproj.dir/myproj.o
Linking C executable myproj
[100%] Built target myproj
Run CPack packaging tool...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: myproj
CPack: - Install project: myproj
CPack: Compress package
CPack: Finalize package
CPack: Package
/home/newelljc/work/src/mkvsprj/build/myproj-0.1.1-Linux.tar.gz
generated.
[newelljc at lcs1 build]$ tar ztf myproj-0.1.1-Linux.tar.gz 
myproj-0.1.1-Linux/bin/myproj



More information about the CMake mailing list