From fba4b76aecd3d26a66295863e30877fea1322442 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 29 Dec 2010 15:30:03 +0100 Subject: [PATCH] build: Added CPack config for source and binary generators. --- CMakeLists.txt | 2 +- CPackConfig.cmake | 53 +++++++++++++++++++++++++++++++++ cmake/Modules/DefineCompilerFlags.cmake | 2 +- cmake/Modules/FindNSIS.cmake | 31 +++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 CPackConfig.cmake create mode 100644 cmake/Modules/FindNSIS.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ace8875..c087424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ include(DefinePlatformDefaults) include(DefineCompilerFlags) include(DefineInstallationPaths) include(DefineOptions.cmake) -#include(CPackConfig.cmake) +include(CPackConfig.cmake) # disallow in-source build include(MacroEnsureOutOfSourceBuild) diff --git a/CPackConfig.cmake b/CPackConfig.cmake new file mode 100644 index 0000000..bcd367c --- /dev/null +++ b/CPackConfig.cmake @@ -0,0 +1,53 @@ +# For help take a look at: +# http://www.cmake.org/Wiki/CMake:CPackConfiguration + +### general settings +set(CPACK_PACKAGE_NAME ${APPLICATION_NAME}) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The lightweight C unit testing library") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README") +set(CPACK_PACKAGE_VENDOR "Google Inc.") +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") + + +### versions +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "1") +set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + + +### source generator +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +if (WIN32) + set(CPACK_GENERATOR "ZIP") + + ### nsis generator + find_package(NSIS) + if (NSIS_MAKE) + set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS") + set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + set(CPACK_NSIS_COMPRESSOR "/SOLID zlib") + set(CPACK_NSIS_MENU_LINKS "https://code.google.com/p/cmockery/" "cmockery homepage") + endif (NSIS_MAKE) +endif (WIN32) + +set(CPACK_PACKAGE_INSTALL_DIRECTORY "cmockery") + +set(CPACK_PACKAGE_FILE_NAME ${APPLICATION_NAME}-${CPACK_PACKAGE_VERSION}) + +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Libraries used to build programs which use cmockery") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with cmockery") +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) +#set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime") +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") + +include(CPack) diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake index 694cbdc..4c88d18 100644 --- a/cmake/Modules/DefineCompilerFlags.cmake +++ b/cmake/Modules/DefineCompilerFlags.cmake @@ -64,5 +64,5 @@ endif (UNIX AND NOT WIN32) if (MSVC) # Suppress warning about "deprecated" functions - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nologo -D_CRT_SECURE_NO_WARNINGS -D_WIN32_WINNT=0x501") endif (MSVC) diff --git a/cmake/Modules/FindNSIS.cmake b/cmake/Modules/FindNSIS.cmake new file mode 100644 index 0000000..c391043 --- /dev/null +++ b/cmake/Modules/FindNSIS.cmake @@ -0,0 +1,31 @@ +# - Try to find NSIS +# Once done this will define +# +# NSIS_FOUND - system has NSIS +# NSIS_MAKE - NSIS creator executable +# +# Copyright (c) 2010 Andreas Schneider +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +if (NSIS_MAKE) + # in cache already + set(NSIS_FOUND TRUE) +elseif (NSIS_MAKE) + find_program(NSIS_MAKE + NAMES + makensis + PATHS + ${_NSIS_DIR} + ${_NSIS_DIR}/Bin + $ENV{PROGRAMFILES}/NSIS + ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(NSIS DEFAULT_MSG NSIS_MAKE) + + mark_as_advanced(NSIS_MAKE) +endif (NSIS_MAKE) -- 2.7.4