[CMake] CMake and CPack question.

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Mon Apr 12 11:57:35 EDT 2010


Are you missing some INSTALL commands?

-------------------------------------------------------------
Aaron Wright
Software Engineer - DCS Group
Schweitzer Engineering Laboratories, Inc.
Pullman, WA 99163
509-334-8087




From:
Roger <rnodal at gmail.com>
To:
cmake at cmake.org
Date:
04/12/2010 08:50 AM
Subject:
[CMake] CMake and CPack question.
Sent by:
cmake-bounces at cmake.org



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})

# 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100412/b03aff91/attachment.htm>


More information about the CMake mailing list