Reputation:
I'm creating a zip with my target binary and header files that go with it. I'm trying to find a way to get this to work without creating a self-named folder inside the zip, and have the zip simply contain the target binary and header files at its root.
Here's the entire project in a small zip (5k) on dropbox: link
Here's how I build and package:
cd Build
cmake ..
make
make package
> cmake --version
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
> cpack --version
cpack version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
> gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is > NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cmake_minimum_required(VERSION 3.2)
###################################################################### PROJECT
project(sis_cg_lib)
###################################################################### FILES
file(GLOB_RECURSE SIS_CG_LIB_INC "deps/*.h" "deps/*.inl" )
file(GLOB_RECURSE SIS_CG_LIB_SRC "sources/*.cpp" )
###################################################################### TARGET
add_library(SIS_CG_Lib ${SIS_CG_LIB_INC} ${SIS_CG_LIB_SRC})
###################################################################### SETTINGS
target_include_directories(SIS_CG_Lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps)
###################################################################### PACKAGE
install(DIRECTORY deps/
DESTINATION deps
)
install(TARGETS SIS_CG_Lib
ARCHIVE DESTINATION .
)
set(CPACK_OUTPUT_FILE_PREFIX "")
set(CPACK_GENERATOR "ZIP" CACHE STRING "Generators to support. semi-colon delimited list")
include(CPack)
libSIS_CG_Lib.a
deps/vec3.h
sis_gc_lib-0.1.1-Linux/libSIS_CG_Lib.a
sis_gc_lib-0.1.1-Linux/deps/vec3.h
Upvotes: 5
Views: 2854
Reputation:
The option I was looking for is called CPACK_INCLUDE_TOPLEVEL_DIRECTORY
I added this line to my CMakeLists.txt before include(CPack)
:
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
Upvotes: 6