[SOLVED] CS # A custom target to create a zip file to handin.

$25

File Name: CS_#_A_custom_target_to_create_a_zip_file_to_handin..zip
File Size: 489.84 KB

5/5 - (1 vote)

# A custom target to create a zip file to handin.

# Version 1: A custom target named zip. Run make zip or cmake build . target zip

# add_custom_target(zip COMMAND
# ${CMAKE_COMMAND} -E tar cfv ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.zip format=zip
# ${SRCS}
# Notes.txt
# CMakeLists.txt
# CMakeLists-zip.txt
# cmake
# ${ARTWORK}
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
# VERBATIM
# )

# Version 2: Describe the package to create. Run make package or cpack.

# Install only what we specify.
install(FILES
Notes.txt
CMakeLists.txt
CMakeLists-zip.txt
DESTINATION .
)
install(FILES
${SRCS}
DESTINATION src
)
install(DIRECTORY cmake
DESTINATION .
)
# No trailing slash after the directory name stores the directory not its contents.
install(DIRECTORY ${ARTWORK}
DESTINATION .
PATTERN .DS_Store EXCLUDE
)

## Lie to cpack about our generator so it doesnt build `preinstall`.
set(CPACK_CMAKE_GENERATOR Ninja)
set(CPACK_GENERATOR ZIP)
set(CPACK_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ON)
set(CPACK_VERBATIM_VARIABLES YES)
include(CPack)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS # A custom target to create a zip file to handin.
$25