Skip to content

Commit

Permalink
Only pass compiler_executables if any defined, add more asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
jcar87 committed Nov 17, 2023
1 parent 21c719c commit c811f91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ macro(append_compiler_executables_configuration)
"Please define CMAKE_CXX_COMPILER or enable the C++ language.")
endif()

string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
if(NOT "${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "")
string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
endif()
unset(_conan_c_compiler)
unset(_conan_cpp_compiler)
endmacro()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ def test_propagate_compiler_mac_autotools(self, capfd, basic_cmake_project):
shutil.copytree(src_dir / 'tests' / 'resources' / 'autotools_dependency', source_dir, dirs_exist_ok=True)
run(f"cmake -S {source_dir} -B {binary_dir} -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES={conan_provider} -DCMAKE_BUILD_TYPE=Release", check=False)
out, err = capfd.readouterr()
assert "checking for g++... g++" in err
assert "configure: error: C++ compiler cannot create executables" not in err
assert "-- Generating done" in out
pass

class TestProfileCustomization:
def test_profile_defaults(self, capfd, basic_cmake_project):
Expand Down

0 comments on commit c811f91

Please sign in to comment.