Skip to content

Commit

Permalink
conan: Do not run tests when cross compiling (CLIUtils#430)
Browse files Browse the repository at this point in the history
* conan: Do not run tests when cross compiling

Running conan create with a profile made for cross compiling would fail since the tests is not compiled for build OS

* Using suggestion from Conan docs

* conan: also add cross_building check in build step

Co-authored-by: Henry Schreiner <[email protected]>
  • Loading branch information
geir-t and henryiii authored Feb 17, 2020
1 parent 80d8e94 commit b974f81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from conans import ConanFile, CMake
from conans.tools import load
from conans.tools import load, cross_building
import re


Expand Down Expand Up @@ -40,7 +40,8 @@ def build(self): # this is not building a library, just tests
cmake.definitions["CLI11_SINGLE_FILE"] = "OFF"
cmake.configure()
cmake.build()
cmake.test()
if not cross_building(self.settings):
cmake.test()
cmake.install()

def package_id(self):
Expand Down
7 changes: 4 additions & 3 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conans import ConanFile, CMake
from conans import ConanFile, CMake, tools
import os


Expand All @@ -16,5 +16,6 @@ def imports(self):
self.copy("*.dylib*", dst="bin", src="lib")

def test(self):
os.chdir("bin")
self.run(".%sexample" % os.sep)
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)

0 comments on commit b974f81

Please sign in to comment.