El 10/01/17 a las 17:34, Gonzalo Garramuño escribió:
I would like to run a custom command on the zip file generated by
cpack. The idea is that I want to calculate its sha256 checksum.
Unfortunately it seems the zip file cannot be a target in a
CMakeLists.txt file or I'm doing something wrong.
Can someone give me a hand?
To answer my own question and for others that might want to do the same:
# Cmake only adds the default package target if a package config file
# named CPackConfig.cmake exists in the outermost binary build directory.
# By forcing the CPack module to generate the package file under a
# different name, we prevent the "target" path from being generated.
SET( CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/BundleConfig.cmake" )
include(CPack)
ADD_CUSTOM_TARGET( bundle
COMMAND "${CMAKE_CPACK_COMMAND}"
"-C" "$"
"--config" "${CMAKE_BINARY_DIR}/BundleConfig.cmake"
COMMENT "Running CPack. Please wait..."
DEPENDS ${PROJECT_NAME})
IF (WIN32)
ADD_CUSTOM_COMMAND( TARGET bundle
POST_BUILD
COMMAND ${CMAKE_COMMAND} -D
CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -D VERSION=${VERSION} "-P"
"${CMAKE_CURRENT_SOURCE_DIR}/../../chocolatey/mrViewer/CMakeLists.txt"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
ENDIF( WIN32 )
This works in that instead of calling make/ninja package you call
make/ninja bundle.
--
Gonzalo Garramuño
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake