cmake - Rename the output of CPack -


i rename installer file cpack (v2.8.7) produces include version number obtained @ build time version control system. appears cannot be done setting cpack_* variables because happens @ "cmake" time.

what want able run "(n)make package" , have installer file created no further commands required. 2 possible approaches aware of manipulating cpack filename variables @ build time , renaming final output of cpack.

if using "include(cpack)" in cmakelists.txt file appears cpack runs last , can't have post-build command. this mailing list message suggests custom target can written run cpack, unable figure out how without creating infinite recursion.

how can done?

with bit of cmake mailing list figured out how it, using subversion.

cmakelists.txt

cmake_minimum_required(version 2.8) project(myapp)  add_executable(main main.cpp) install(targets main destination .)  add_custom_target(first     # update working copy     command ${subversion_svn_executable} update ${cmake_source_dir}      # generate cpackoptions.cmake @ build time     # recent revision number     command ${cmake_command}     -dsource_dir=${cmake_source_dir}     -dbinary_dir=${cmake_binary_dir}     -dproj_name=${cmake_project_name}     -p ${cmake_source_dir}/create-cpackoptions.cmake     )  add_dependencies(main first)  set(cpack_project_config_file ${cmake_binary_dir}/cpackoptions.cmake)  include(cpack) 

create-cpackoptions.cmake

include(findsubversion) subversion_wc_info(${source_dir} ${proj_name})  set(revision ${${proj_name}_wc_revision})  configure_file(${source_dir}/cpackoptions.cmake.in     ${binary_dir}/cpackoptions.cmake     @only) 

cpackoptions.cmake.in

set(cpack_package_file_name "@proj_name@-${cpack_package_version}r@revision@-${cpack_system_name}") 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -