Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/functional/toolchains/cmake/test_cmake_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2063,3 +2063,40 @@ def build(self):
else:
client.run("build . -s compiler.cppstd=11")
# It doesn't fail


@pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows")
@pytest.mark.tool("cmake")
def test_cmaketoolchain_check_function_exists():
c = TestClient()
conanfile = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain
class Conan(ConanFile):
settings = "os", "compiler", "arch", "build_type"

def generate(self):
tc = CMakeToolchain(self)
# This gets back to older default behavior
# tc.blocks["try_compile"].values["config"] = None
tc.generate()

def build(self):
CMake(self).configure()
""")
consumer = textwrap.dedent("""
cmake_minimum_required(VERSION 3.15)
project(MyHello C)

include(CheckFunctionExists)
check_function_exists(pow HAVE_POW)
check_function_exists(sin HAVE_SIN)
if(NOT HAVE_POW OR NOT HAVE_SIN)
message(FATAL_ERROR "Not math!!!!!")
endif()
""")
c.save({"conanfile.py": conanfile,
"CMakeLists.txt": consumer})

c.run("build . ") # Release breaks the check
print(c.out)
Loading