-
Notifications
You must be signed in to change notification settings - Fork 989
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
only warn in CMake if build_type is empty and is_multi configuration #14349
Changes from 1 commit
722382d
5c4cf44
dd2edc1
6cfe578
daa3bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,52 @@ def run(self, *args, **kwargs): | |
assert "-something" in client.out | ||
assert "--testverbose" in client.out | ||
assert "-testok" in client.out | ||
|
||
def test_build_type_single_config_warn(): | ||
client = TestClient() | ||
|
||
conanfile = textwrap.dedent(""" | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake | ||
class Pkg(ConanFile): | ||
name = "pkg" | ||
version = "0.1" | ||
settings = "os", "compiler", "arch" | ||
generators = "CMakeToolchain" | ||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This build, in single-config build systems is not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can I specify a build type then in this case a profile does not specify any build_type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not defining the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refering to settings.yml the |
||
cmake.build(build_type="Release") | ||
def run(self, *args, **kwargs): | ||
self.output.info("MYRUN: {}".format(*args)) | ||
""") | ||
client.save({"conanfile.py": conanfile}) | ||
client.run("create . ") | ||
assert "Specifying 'build_type' does not have " + \ | ||
"any effect for single-config build systems" in client.out | ||
assert "Created package" in client.out | ||
|
||
def test_build_type_empty(): | ||
client = TestClient() | ||
|
||
conanfile = textwrap.dedent(""" | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake | ||
class Pkg(ConanFile): | ||
name = "pkg" | ||
version = "0.1" | ||
settings = "os", "compiler", "arch" | ||
generators = "CMakeToolchain" | ||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
cmake.install() | ||
def run(self, *args, **kwargs): | ||
self.output.info("MYRUN: {}".format(*args)) | ||
""") | ||
client.save({"conanfile.py": conanfile}) | ||
client.run("create . ") | ||
assert "Created package" in client.out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests passes in PRs because they run only in Linux in PRs. After merge, they will run in Windows too and fail (these tests fail in Windows due to multi-config VS). It would be better to move them to "functional" folder, so they run in all platforms also in PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best is to do actual builds, with fully functional examples in the "functional" folder, building libraries with full
test_package
functionality. This will make sure things are working.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created some tests for my all my use cases under functional. I always set build_type via
-s build_type=Debug
.