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

Add rc compiler to compiler_executables #632

Open
wants to merge 3 commits into
base: develop2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,19 @@ macro(append_compiler_executables_configuration)
"Please define CMAKE_C_COMPILER or enable the C language.")
endif()
if(CMAKE_CXX_COMPILER)
set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"")
set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\",")
set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler)
else()
message(WARNING "CMake-Conan: The C++ compiler is not defined. "
"Please define CMAKE_CXX_COMPILER or enable the C++ language.")
endif()
if(CMAKE_RC_COMPILER)
set(_conan_rc_compiler "\"rc\":\"${CMAKE_RC_COMPILER}\"")
# Not necessary to warn if RC not defined
endif()

if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "x")
string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}${_conan_rc_compiler}" STREQUAL "x")
string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}${_conan_rc_compiler}}\n")
endif()
unset(_conan_c_compiler)
unset(_conan_cpp_compiler)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_propagate_cxx_compiler(self, capfd, basic_cmake_project):
out, err = capfd.readouterr()
assert "The CXX compiler identification is GNU" in out
assert "CMake-Conan: The C compiler is not defined." in err
assert 'tools.build:compiler_executables={"cpp":"/usr/bin/c++"}' in out
assert 'tools.build:compiler_executables={"cpp":"/usr/bin/c++",}' in out

@linux
def test_propagate_c_compiler(self, capfd, basic_cmake_project):
Expand All @@ -318,7 +318,7 @@ def test_propagate_c_compiler(self, capfd, basic_cmake_project):
out, err = capfd.readouterr()
assert "The CXX compiler identification is GNU" in out
assert "The C compiler is not defined." not in err
assert 'tools.build:compiler_executables={"c":"/usr/bin/cc","cpp":"/usr/bin/c++"}' in out
assert 'tools.build:compiler_executables={"c":"/usr/bin/cc","cpp":"/usr/bin/c++",}' in out

@linux
def test_propagate_non_default_compiler(self, capfd, basic_cmake_project):
Expand All @@ -328,7 +328,7 @@ def test_propagate_non_default_compiler(self, capfd, basic_cmake_project):
out, err = capfd.readouterr()
assert "The CXX compiler identification is Clang" in out
assert "The C compiler is not defined." not in err
assert 'tools.build:compiler_executables={"c":"/usr/bin/clang","cpp":"/usr/bin/clang++"}' in out
assert 'tools.build:compiler_executables={"c":"/usr/bin/clang","cpp":"/usr/bin/clang++",}' in out

@darwin
@pytest.mark.parametrize("cmake_generator", ["Unix Makefiles", "Xcode"])
Expand Down