Oh, that is some kind of special street magic!
Post by Vyacheslav KaramovThank you very much, Eric!
It works!
----------- CMakeLists.txt ------------------
include (FindSubversion)
if (NOT Subversion_FOUND)
message(FATAL_ERROR "Please install subversion command-line client and
add its folder to the system PATH")
endif()
# Update working copy at every non-debug build
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
add_custom_target(svn_up ALL
# update the working copy
COMMAND ${Subversion_SVN_EXECUTABLE} up ${CMAKE_SOURCE_DIR}
)
endif() # if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
# Add code which adds svn revision info at every build
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} ${CMAKE_PROJECT_NAME})
set(chatterbox_revision ${${CMAKE_PROJECT_NAME}_WC_REVISION})
# set product version
set (chatterbox_version_major 1)
set (chatterbox_version_minor 0)
set (chatterbox_version_patch 0)
set (chatterbox_version "${chatterbox_version_major},
${chatterbox_version_minor}, ${chatterbox_version_patch},
${chatterbox_revision}")
set(version_h_contents "/**
* Copyright (c) 2008-2012 Transparent Language, Inc. All rights reserved.
*/
#define _VESRION_NUMBER_ ${chatterbox_version}
#define _PRODUCT_NUMBER_ ${chatterbox_version}
#define _VERSION_STRING_ \"${chatterbox_version}\"
#define _PRODUCT_STRING_ \"${chatterbox_version}\"
")
#Write version.h
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/chatterbox/src/version.h"
${version_h_contents})
set (package_version
"${chatterbox_version_major}.${chatterbox_version_minor}.${chatterbox_version_patch}")
add_custom_target(configure_cpack ALL
# generate cpackoptions.cmake at build time so we get the
# most recent revision number
COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-Dproj_name=${CMAKE_PROJECT_NAME}
-Drevision=${chatterbox_revision}
-Dpack_version=${package_version}
-P ${CMAKE_SOURCE_DIR}/cmake/Create-cpackoptions.cmake
)
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
add_dependencies(configure_cpack svn_up)
endif()
set(CPACK_PROJECT_CONFIG_FILE
${CMAKE_SOURCE_DIR}/cmake/CPackOptions.cmake)
----------- CMakeLists.txt ------------------
---------------Create-cpackoptions.cmake--------------
configure_file(${SOURCE_DIR}/cmake/CPackOptions.cmake.in
${SOURCE_DIR}/cmake/CPackOptions.cmake
@ONLY)
---------------Create-cpackoptions.cmake--------------
--------------------------CPackOptions.cmake.in-----------------------
set(CPACK_PACKAGE_FILE_NAME
--------------------------CPackOptions.cmake.in-----------------------
Post by Eric NoulardPost by Vyacheslav KaramovHi All!
Is it possible to change rpath at the packaging stage?
CPack is using cmake_install.cmake scripts which gets influenced
by CMAKE_INSTALL_RPATH variable and/or INSTALL_RPATH target property.
Did you try to play with that? i.e.
SET(CMAKE_INSTALL_RPATH "/opt/chatterbox")
you may try to set this in a CPACK_PROJECT_CONFIG_FILE
in order to set it to a "CPack-time" specific value.
That said I'm not sure it'll work because I don't know for sure "when exactly"
CMAKE_INSTALL_RPATH is processed, but iit's simple to try.
Post by Vyacheslav Karamovif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND EXISTS
"${CMAKE_ROOT}/Modules/CPack.cmake")
SET(install_dir "/opt/chatterbox")
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "/usr/local/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
...
endif()
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.cmake.org/Wiki/CMake_FAQ
http://www.cmake.org/mailman/listinfo/cmake