The plugin aims to provide basic integration with conan C/C++package manager.
Main features:
* direct integration via Gradle DSL (without conan.txt
and generation step)
* separate packages list for test
* shared version of package can be used as runtime dependency
* support of multiple options for each package
* automatic build of debug package version for MSVC
* integration with project toolchain and C++ standard
* compatible with IDE generation plugin and compilation database generator
The cpp-conan
requires to work other Gradle core plugins: cpp-application
/cpp-library
/cpp-unit-test
.
conan
in your system follow official instruction (make sure that it available via PATH)plugins {
`cpp-application`
`cpp-unit-test`
id("net.sf.loggersoft.cpp-conan") version "0.1"
}
conan {
//requires("zstd") version "1.5.6" option ("shared" to "true")
//requires("zstd") version "1.5.6" shared true
requires("zstd") version "1.5.6"
requires("boost") version "1.86.0" option ("zstd" to "false") option ("lzma" to "false")
//requires("bzip2") version "1.0.8"
//requires("boost") version "1.70.0#revision2"
//requires("poco") version "[>1.0 <1.9]" option ("shared" to "true")
//testRequires("gtest") version "1.15.0" shared true
testRequires("gtest") version "1.15.0"
build = "~zlib"
//remote = "https://center2.conan.io"
//offline = true
}
requires - the package dependency with mandatory version and arbitrary options as pairs of string key/value. The option shared
can be passed in this way: shared true/false
.
testRequires - the package dependency required only for test (e.g. gtest
). The format is the same with requires.
build - the build policy, for more details see here.
remote - look in the specified remote server(s), for more details see here.
offline - do not use remote, resolve exclusively in the cache.
Full sources of simple conan-app.