Giter Club home page Giter Club logo

cmakehelpers's Introduction

CMakeHelpers

CMakeHelpers is a set of cmake scripts that never will be in official cmake distribution. Find*-scipts are mostly based on FindBoost.cmake that included in official distribution of cmake.

Using scripts in your project

To use scripts you can download single files of interest to your repository.

Also you can use this repository as submodule.

Using git submodule

Imagine that you have cmake-based project in ProjectDir folder. You can initialize CMakeHelpers submodule with commands:

git submodule add https://github.com/halex2005/CMakeHelpers.git
git commit -m "init CMakeHelpers submodule"

When you need to clone your repository you should init submodules with

git submodule init
git submodule update

Using scripts in CMakeFiles.txt

To use contents of ProjectDir/CMakeHelpers folder you should add this lines to your ProjectDir/CMakeLists.txt file:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeHelpers")

Then you can use find_package command in your CMakeLists.txt files, i.e. in case of FindResiprocate.cmake:

find_package(Resiprocate 1.9 EXACT COMPONENTS resip recon)
if (NOT Resiprocate_FOUND)
    message(SEND_ERROR "Failed to find Resiprocate")
    return()
else()
    include_directories(${Resiprocate_INCLUDE_DIRS})
    link_directories(${Resiprocate_LIBRARY_DIRS})
endif()
# and you can add target links like:
# target_link_libraries(<target-name> ${Resiprocate_LIBRARIES})

Using generate_product_version

Basic usage:

include(generate_product_version)

generate_product_version(ProductVersionFiles
    NAME MyProduct
    VERSION_MAJOR 3
    VERSION_MINOR 2
    VERSION_PATCH 12
    VERSION_REVISION 30303
    COMPANY_NAME MyCompany)

Two files will be generated in CMAKE_CURRENT_BINARY_DIRECTORY. ProductVersionFiles output variable will be filled with path names to generated files.

You can use generated resource for your executable targets:

add_executable(target-name ${target-files} ${ProductVersionFiles})

You can specify the resource strings in arguments:

  • NAME - name of executable (no defaults, ex: Microsoft Word)
  • BUNDLE - bundle (${NAME} is default, ex: Microsoft Office)
  • ICON - path to application icon (${CMAKE_SOURCE_DIR}/product.ico is default)
  • VERSION_MAJOR - 1 is default
  • VERSION_MINOR - 0 is default
  • VERSION_PATCH - 0 is default
  • VERSION_REVISION - 0 is default
  • COMPANY_NAME - your company name (no defaults)
  • COMPANY_COPYRIGHT - ${COMPANY_NAME} (C) Copyright ${CURRENT_YEAR} is default
  • COMMENTS - ${NAME} v${VERSION_MAJOR}.${VERSION_MINOR} is default
  • ORIGINAL_FILENAME - ${NAME} is default
  • INTERNAL_NAME - ${NAME} is default
  • FILE_DESCRIPTION - ${NAME} is default

Licensing

CMakeHelpers library is distributed under MIT license

Copyright (C) 2015, by halex2005
Report bugs and download new versions at https://github.com/halex2005/CMakeHelpers

PayPal donate button Gratipay donate button

cmakehelpers's People

Contributors

halex2005 avatar loktionov129 avatar ruudsieb avatar bwrsandman avatar ravenpride avatar velorom avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.