Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting arch to conan_cmake_settings #70

Merged
merged 2 commits into from
Feb 14, 2018
Merged

Allow setting arch to conan_cmake_settings #70

merged 2 commits into from
Feb 14, 2018

Conversation

bc-lee
Copy link
Contributor

@bc-lee bc-lee commented Jan 30, 2018

Fixes: #68

@memsharded
Copy link
Member

Is this a duplicate of #69?

@bc-lee bc-lee changed the title Allow passing NO_OUTPUT_DIRS to conan_cmake_run Allow setting arch to conan_cmake_settings Jan 30, 2018
@bc-lee
Copy link
Contributor Author

bc-lee commented Jan 30, 2018

No, it was my mistake and a modified commit has been added to this pull request.

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I think this might deserve to add a test. Could you please try to add one? Thanks!

@bc-lee
Copy link
Contributor Author

bc-lee commented Jan 31, 2018

Seems like the package Hello/0.1@memsharded/testing that is used in tests are not elegible to build 32bit-binaries in 64bit Linux..

A quick and dirty solution for patching conanfile.py using AutoToolsBuildEnvironment is follows:

diff --git a/conanfile.py b/conanfile.py
index 3a45fc4..693b309 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -1,4 +1,4 @@
-from conans import ConanFile, CMake
+from conans import ConanFile, CMake, AutoToolsBuildEnvironment, tools
    
 class HelloConan(ConanFile):
     name = "Hello"
@@ -11,9 +11,11 @@ class HelloConan(ConanFile):
         self.run("git clone https://github.com/memsharded/hello.git")
 
     def build(self):
-        cmake = CMake(self)
-        self.run('cd hello && cmake . %s' % cmake.command_line)
-        self.run("cd hello && cmake --build . %s" % cmake.build_config)
+        autotools = AutoToolsBuildEnvironment(self)
+        with tools.environment_append(autotools.vars):
+            cmake = CMake(self)
+            self.run('cd hello && cmake . %s' % cmake.command_line)
+            self.run("cd hello && cmake --build . %s" % cmake.build_config)
 
     def package(self):
         self.copy("*.h", dst="include", src="hello")

@memsharded
Copy link
Member

Thanks for contributing this!
I will try to add a conditional test or something for the next release.

@bc-lee bc-lee deleted the feature/68_allow_setting_arch_to_conan_cmake_settings branch February 14, 2018 21:46
wawa19933 pushed a commit to wawa19933/cmake-conan that referenced this pull request Mar 19, 2020
…rch_to_conan_cmake_settings

Allow setting arch to conan_cmake_settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants