No description, website, or topics provided.
Clone or download

README.md

Build status

cmake-external-packages

cmake-external-packages can help you to start using on Windows some of libraries which are not support cmake configuration.

This repository does not contain any binary files, it contains only cmake plain text configurations for packages.

Why you'll need it?

Some libraries have very good support for linux, but bad support on windows. They can provide Visual Studio (VS) project files, but for only one VS version. When you use cmake, it is inconvinient to consume this kind of libraries, because of you need to link with right compiler settings (or you'll got unresolved reference linker errors). If you have cmake targets for these libraries, you'll compile and link without errors.

Why not to use cmake's ExternalProject?

Unfortunately, cmake's ExternalProject_Add command works in build phase, not in configure/generate phase. How it looks? Suppose you wrote

ExternalProject_Add(GIT_REPOSITORY git@repository.here)

Then you'll run generate phase by cmake path/to/source command. Nothing will happens here. Git repository you specify will be cloned only when you run build process for your project.

How to use?

Use git-subtree, git-submodule or just copy this repository contents to your repository subfolder.

Declare EXTERNAL_PACKAGES_INCLUDE_DIR option in your top-level CMakeLists.txt and add include directories:

set (EXTERNAL_PACKAGES_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/include
    CACHE STRING "Directory for third-party include files, where include folders will be copied")
include_directories(${EXTERNAL_PACKAGES_INCLUDE_DIR})

Add packages you want to use with add_subdiretory. For example, to use protobuf:

add_subdirectory(path/to/cmake-external-packages/protobuf-v2)

Thats all. Included package will download source code zip file, extract it and generate cmake targets to build and consume.

Now you can link your code with protobuf like:

add_executable(my_exe ${my_exe_sources})
target_link_libraries(my_exe libprotobuf)

Which packages are supported?

Contributions are welcome!

Licensing

cmake-external-packages library is distributed under MIT license

Copyright (C) 2016 halex2005 Report bugs and download new versions at https://github.com/halex2005/cmake-external-packages/issues

PayPal donate button Gratipay donate button