2012/4/19 <lazyl...@gmail.com>: > Hi, > > I'm using cmake and cpack to build my project and build packages. I'm > creating a few executables in my project, let's call them EXE1 and > EXE2. > > When creating different versions of these executables, I want to name > to reflect the version of the executable (let's say EXE1_1.0.0). I can > change the name of the output for a target by doing > set_target_properties. > > However, now when doing an install, I want to do create a symlink to > this versioned name of the executable, i.e. I want to have > > the "versioned" executable installed in bin directory, i.e. EXE1_1.0.0 > create a symlink to the "versioned" executable, i.e. create > symlink EXE1, which points to EXE1_1.0.0 > > Can someone suggest me how to do this?
The validity of the answer will depend on which CMake version you use and which set of platform you want to support. Symlinks are not that portable a) Creation may not be [currently] done portably but if you are targeting Unix you can use cmake -E create_symlink to create one. b) Depending on the CPack generator you use and CMake/CPack version symlinks may be embedded in the package or not. i.e. CPack pre 2.8.7 cannot create ZIP archive which contains symlinks CPack 2.8.8 can do that now. Then you can use an install(SCRIPT ... or install(CODE ...) to do that at install time. Another option if you are using RPM is to use package specific post install script. cpack --help-variable CPACK_RPM_POST_INSTALL_SCRIPT_FILE this last solution will off course only work for CPack RPM. > Second question is: How to install configuration files /etc/MYPROJECT/ > directory? What DESTINATION I need to use for configuration files, > like I use bin for executables and lib for libraries? Is using an > absolute path like /etc an acceptable practice with cmake? You can use absolute destination path, they should be handled just fine by CPack DEB and RPM, I don't know for other. If your software should be installed on Windows this is won't work with archive generator (ZIP, TGZ, etc...) and/or NSIS. May be you can do something like: if(UNIX AND NOT APPLE) set(CONFDEST "/etc/${CMAKE_PROJECT_NAME}") else() set(CONFDEST "etc") endif() install(FILES yourconffile DESTINATION ${CONFDEST}) -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake