On Mon, Apr 12, 2010 at 5:50 PM, Roger <rno...@gmail.com> wrote: > Hello, > > I have been using CMake (2.6) for a couple weeks now (I really like > it) and so far I have been able to do all I needed by just following > the documentation. > After getting my software built and confirmed that it works in my > development machine I would like to pack it so I can install it in my > production machine > using RPM. I have gotten as far as generating RPM, SH, TGZ etc > packages to build but they seem to be useless (to say the least). I'm > pretty sure that I'm missing something so > I was wondering if someone with experience generating installation > packages could point me in the right direction. This is a very simple > project and there is only one file > to install, a binary file. I know that using CMake for this may be > overkill but I figured that I do this one then it would be easier to > tackle bigger ones. > Here is my current CMake files. > > ============ CMakeLists.cmake ================ > # Minumum CMake version. > CMAKE_MINIMUM_REQUIRED(VERSION 2.6) > > # Set CMake modules path. > SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") > > # Project name. > PROJECT(sqlconnmonit) > > # Find MYSQL. > FIND_PACKAGE(SQL REQUIRED MYSQL_INCLUDE_DIR) > > # Add MYSQL headers. > INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR}) > > # Add MYSQL lib to the list of libraries to use. > SET(LIBS ${LIBS} ${MYSQL_LIB_DIR}) > > # Compiler flags. > # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") > > # The source code file(s) that form the executable. > ADD_EXECUTABLE(sqlconnmonit src/sqlconnmonit.c src/options.c > src/utils.c src/mysql.c)
> # Link against external libraries. > TARGET_LINK_LIBRARIES(sqlconnmonit ${LIBS}) > Roger, If you want CPack to automagically determine which binaries to package, you should add the sqlconnmonit executable to the install target [1] HTH, Adolfo [1] http://cmake.org/cmake/help/cmake-2-8-docs.html#command:install > > # CPACK. > INCLUDE(InstallRequiredSystemLibraries) > SET(CPACK_INSTALL_CMAKE_PROJECTS > "${CMAKE_SOURCE_DIR}/build;${CMAKE_PROJECT_NAME};ALL;/") > SET(CPACK_GENERATOR "STGZ;TGZ;TZ;RPM;DEB") > SET(CPACK_PACKAGE_VERSION_MAJOR "0") > SET(CPACK_PACKAGE_VERSION_MINOR "1") > SET(CPACK_PACKAGE_VERSION_PATCH "0") > SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MySQL server connections monitor.") > SET(CPACK_PACKAGE_VENDOR "Super Cool Vendor") > SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/opt/sqlmonitor/bin") > > SET(CPACK_RPM_PACKAGE_SUMMARY "MySQL server connections monitor.") > SET(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") > SET(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") > SET(CPACK_RPM_PACKAGE_RELEASE "1") > SET(CPACK_RPM_PACKAGE_LICENSE "BSD") > SET(CPACK_RPM_PACKAGE_GROUP "unknown") > SET(CPACK_RPM_PACKAGE_VENDOR "Super Cool Vendor") > SET(CPACK_RPM_PACKAGE_DESCRIPTION "MySQL server connections monitor.") > SET(CPACK_RPM_PACKAGE_REQUIRES "cmake >= 2.6, mysql-devel >= 5.0") > > SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "ME") > SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY > "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") > SET(CPACK_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") > > INCLUDE(CPack) > > > ============ FindSQL.cmake ==================== > > # Locate MYSQL library > # > > # Find MYSQL include. > MESSAGE("-- Looking for MySQL include directory") > > FIND_PATH(MYSQL_INCLUDE_DIR > mysql.h > PATHS > /usr/include/mysql > /usr/local/include/mysql > > ) > > IF (MYSQL_INCLUDE_DIR) > MESSAGE("-- MySQL include directory found") > MESSAGE("-- MYSQL_INCLUDE_DIR is ${MYSQL_INCLUDE_DIR}") > ELSE (MYSQL_INCLUDE_DIR) > MESSAGE(FATAL_ERROR "-- Could not find MySQL includes directory") > ENDIF (MYSQL_INCLUDE_DIR) > > # Find MYSQL lib. > MESSAGE("-- Looking for MySQL lib directory") > > FIND_LIBRARY(MYSQL_LIB_DIR > NAMES > mysqlclient libmysqlclient > PATHS > /usr/local/lib > /usr/local/lib64 > /usr/lib > /usr/lib/mysql > /usr/lib64 > /usr/lib64/mysql > ) > > > IF (MYSQL_LIB_DIR) > MESSAGE("-- MySQL lib directory found") > MESSAGE("-- MYSQL_LIB_DIR is ${MYSQL_LIB_DIR}") > ELSE (MYSQL_LIB_DIR) > MESSAGE(FATAL_ERROR "-- Could not find MySQL lib directory") > ENDIF (MYSQL_LIB_DIR) > > ============================================= > > Any input would be appreciated. Any complete sample to a CMake to > generate a RPM package > would be greatly appreciated. Anything would be appreciated. > > Thank you for your time, > > -r > _______________________________________________ > 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 > -- Adolfo Rodríguez Tsouroukdissian, Ph. D. Robotics engineer PAL ROBOTICS S.L http://www.pal-robotics.com Tel. +34.93.414.53.47 Fax.+34.93.209.11.09 AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden contener información privilegiada y/o confidencial que está dirigida exclusivamente a su destinatario. Si usted recibe este mensaje y no es el destinatario indicado, o el empleado encargado de su entrega a dicha persona, por favor, notifíquelo inmediatamente y remita el mensaje original a la dirección de correo electrónico indicada. Cualquier copia, uso o distribución no autorizados de esta comunicación queda estrictamente prohibida. CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may contain confidential information which is privileged and intended only for the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or accompanying document(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender at the above e-mail address.
_______________________________________________ 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