[CMake] CPack, TGZ and directory layout

allan at awn.dk allan at awn.dk
Fri Apr 2 15:56:28 EDT 2010


Hey

I'am using Cmake/cpack 2.8.1, and are having some problems controling
the directory layout generated by CPack.

Following are a short example illustrating my problem:

############# SNIPIT START (PASTE INTO LINUX CONSOLE) ############
mkdir test
cd test
cat > test.c << EOF
int main(int ac, char * av[]){ return 0; }
EOF

cat > CMakeLists.txt << EOF
cmake_minimum_required (VERSION 2.8)
project (TEST)
set(CPACK_GENERATOR TGZ)
SET(CPACK_SET_DESTDIR "ON")
SET(CPACK_PACKAGING_INSTALL_PREFIX "/asdf/")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/asdf/")
set(CMAKE_INSTALL_PREFIX /)
set(CPACK_PACKAGE_NAME TEST)

INCLUDE(CPack)

add_executable (test test.c)
INSTALL(TARGETS test RUNTIME DESTINATION bin)
EOF

mkdir .build
cd .build
cmake ..
make
make package
############# SNIPIT END (PASTE INTO LINUX CONSOLE) ############


This will generate the file TEST-0.1.1-Linux.tar.gz, which cat be
extracted:

tar -xzvf TEST-0.1.1-Linux.tar.gz

The result of this the the following file:
TEST-0.1.1-Linux/bin/test

What I would like to achieve is that the directory layout of the
generated tar file is:

/bin/test

or maby

bin/test

But in either case without the Project name folder.

Thanks in advance
Allan W. Nielsen





More information about the CMake mailing list