Upgrading to conan 1.0¶
This section summarizes the most important changes you need to consider when upgrading to Conan v1.0 from version 0.x. For a full list of changes and considerations, please refer to the changelog.
Command line changes¶
There are a few breaking changes (compared to v0.30), however, most of them are in command line arguments so they are quite easy to fix. The most significant change is that now, instead of using
--file arguments, most commands now require the path to the conanfile folder or file. Specifically, conan install, conan export and conan create will be the ones most affected:
# instead of --path=myfolder --file=myconanfile.py, now you can do: $ conan install . # Note the "." is now mandatory $ conan install folder/myconanfile.txt $ conan install ../myconanfile.py $ conan info . $ conan create . user/channel $ conan create . Pkg/0.1@user/channel $ conan create mypkgconanfile.py Pkg/0.1@user/channel $ conan export . user/channel $ conan export . Pkg/0.1@user/channel $ conan export myfolder/myconanfile.py Pkg/0.1@user/channel
This behavior aligns with the conan source, conan build, conan package commands, that all use the same arguments to locate the conanfile.py file containing the logic to be run.
Now, all commands read: command <origin-conanfile> ...
In addition, all command line arguments now use a dash instead of an underscore:
$ conan build .. --source-folder=../src # not --source_folder
- scopes were completely removed in conan 0.30.X
self.conanfile_directoryhas been removed. Instead, use
self.user_infoscope are now only included the
ConfigureEnvironmentwere removed in conan 0.30.1
werrordoesn’t exist anymore. It is now built-in behavior.
test_packagecommand has been removed. Instead, use conan create and conan test.
- From Conan v0.29, the``CMake`` helper only supports the
- In Conan v0.28, the conan package_files command was replaced by the conan export-pkg command.
Settings and profiles. GCC/CLang versioning¶
The GCC and Clang compilers have modified their versioning approach. From GCC version 5 and above and Clang version 4 and above, minor versions are really bug fixes, and then, they have binary compatibility. To adapt to this, Conan now includes a major version in the settings.yml default settings file:
gcc: version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", "5", "5.1", "5.2", "5.3", "5.4", "6", "6.1", "6.2", "6.3", "6.4", "7", "7.1", "7.2"]
Most package creators want to use the major-only settings, like
-s compiler=gcc -s compiler.version=5,
instead of specifying the minors too.
The default profile detection and creation has been modified accordingly, however, if you have a default profile you may want to update it to reflect this:
[settings] os=Linux compiler=gcc compiler.version=7 #instead of 7.2
Conan associated tools (conan-package-tools, conan.cmake) have been upgraded to accomodate these new defaults.
- Cross-compilation support with new default settings in settings.yml:
arch_target. These are automatically removed from the
package_idcomputation, or kept if they are the only ones defined (as usually happens with dev-tools packages). You can also keep them with the
self.info.include_build_settings()method (call it in your
Do not use cross-build settings
arch_buildfor standard packages and libraries.
They are only useful for packages that are used via
- Model and utilities for Windows subsystems
os: Windows: subsystem: [None, cygwin, msys, msys2, wsl]
This subsetting can be used by build helpers such as
CMake to act accordingly.