Closed Ju1He1 closed 2 years ago
Hi @Ju1He1
I guess you should add this line in your recipe (have a look at this docs section):
class CouchbaseLiteCoreConan(ConanFile):
# ...
def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0"
tc.generate()
and remove the CONAN_CMAKE_SYSTEM_VERSION=10.0
line from [env]
section. I think it could do the trick.
@franramirez688 There is already some logic in the GenericSystemBlock
that will set the CMAKE_SYSTEM_VERSION for some cases. Maybe it would better to change it in its context "cmake_system_version": system_version
instead, to avoid possible colisions.
But not necessary, there is new conf
for this:
system_name = self._conanfile.conf.get("tools.cmake.cmaketoolchain:system_name")
system_version = self._conanfile.conf.get("tools.cmake.cmaketoolchain:system_version")
system_processor = self._conanfile.conf.get("tools.cmake.cmaketoolchain:system_processor")
Use this new conf in the profile instead of hardcoding in the recipe.
Some other recommended changes:
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
from conans import tools # This one has also other new tools like ``conan.tools.scm import Git``
Thank you both for your fast answer :)
@franramirez688 your solution worked. Couchbase build properly :) However Windows is just one config out of many. I'd like to keep my recipe as generic as possible. That's why we are using build profiles ;)
@memsharded
I did add
[options]
system_version=10.0
to my build profile and replaced the imports with your suggestions :) However this does not seam to have any effect. Our build server are still running conan 1.45. Do i have to upgrade conan?
Do I have to explicitly set
system_version = self._conanfile.conf.get("tools.cmake.cmaketoolchain:system_version")
somewhere in my recipe?
Not, it is not an option, is a "conf". In the profile:
[conf]
tools.cmake.cmaketoolchain:system_version=10.0
ups yeah you are right. I fixed that. But still it does not seam to take effect
$ conan create . -pr:b=foo
Exporting package recipe
LiteCore/2.0: A new conanfile.py version was exported
LiteCore/2.0: Folder: C:\Users\Administrator\.conan\data\LiteCore\2.0\_\_\export
LiteCore/2.0: Exported revision: efb74f9e1cdd536c4136dc628621ca13
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
[conf]
tools.cmake.cmaketoolchain:system_version=10.0
do I have to modify my recipe as well? Sorry I'm a little bit stuck here :O
You are specifying it in the build
profile only, but it should be done in the host
profile, not in the build
one.
thank you James. That did work :)
Hey guys, unfortunately on our buildserver there are lots of old Windows SDKs installed. By default CMake chooses an old SDK which is not compatible with MSCV 17 any more. I managed to get rid of this issue inside the project by setting "CMAKE_SYSTEM_VERSION" to "10.0" The build without any thirdparties works.
Now If I add the thirdparties Couchbase-Lite suffers the same problem. Conan uses the old Windows SDK when trying to build couchbase lite
My conan profile looks like this
The recipe used to build Couchbase Lite looks like this
I'm calling
conan create . -pr:b=foo
to build the packageThe (truncated) output looks like this
Now if you check the cmake -G command there is not CMAKE_SYSTEM_VERSION passed here. Should the CMAKE_SYSTEM_VERSION not being passed to the cmake generator? Or Am I missing something?
Environment Details (include every applicable attribute)
Thx for your help :)