Skip to content

Commit 82b04f2

Browse files
authored
Merge pull request #476 from jcar87/lcc/experimental/dep-provider-generator-logic
dep provider: fixes
2 parents 1f33316 + e2bb886 commit 82b04f2

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

conantools.cmake

+13-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ function(detect_compiler COMPILER COMPILER_VERSION)
4343
set(_COMPILER "apple-clang")
4444
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
4545
list(GET VERSION_LIST 0 _COMPILER_VERSION)
46+
elseif(_COMPILER MATCHES Clang)
47+
set(_COMPILER "clang")
48+
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
49+
list(GET VERSION_LIST 0 _COMPILER_VERSION)
50+
elseif(_COMPILER MATCHES GNU)
51+
set(_COMPILER "gcc")
52+
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
53+
list(GET VERSION_LIST 0 _COMPILER_VERSION)
4654
endif()
4755

4856
message(STATUS "Conan-cmake: [settings] compiler=${_COMPILER}")
@@ -91,6 +99,10 @@ function(detect_host_profile output_file)
9199
else()
92100
set(_FN ${output_file})
93101
endif()
102+
103+
string(APPEND PROFILE "[conf]\n")
104+
string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n")
105+
94106
message(STATUS "Conan-cmake: Creating profile ${_FN}")
95107
file(WRITE ${_FN} ${PROFILE})
96108
message(STATUS "Conan-cmake: Profile: \n${PROFILE}")
@@ -128,7 +140,7 @@ function(conan_provide_dependency package_name)
128140
if(NOT CONAN_INSTALL_SUCCESS)
129141
message(STATUS "CMake-conan: first find_package() found, running 'conan install' to install deps")
130142
detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile)
131-
if(CMAKE_BUILD_TYPE)
143+
if(NOT CMAKE_CONFIGURATION_TYPES)
132144
message(STATUS "CMake-conan: Intalling single configuration ${CMAKE_BUILD_TYPE}")
133145
conan_install(-pr ${CMAKE_BINARY_DIR}/conan_host_profile --build=missing -g CMakeDeps)
134146
else()

tests_new.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,24 @@ def test1():
8585
shutil.copy2(os.path.join(os.path.dirname(__file__), "conan_provider.cmake"), ".")
8686
shutil.copy2(os.path.join(os.path.dirname(__file__), "conaninstall.cmake"), ".")
8787
shutil.copy2(os.path.join(os.path.dirname(__file__), "conantools.cmake"), ".")
88-
with chdir("build"):
89-
if platform.system() == "Windows":
88+
89+
if platform.system() == "Windows":
90+
with chdir("build"):
9091
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake")
9192
run("cmake --build . --config Release")
9293
run("cmake --build . --config Debug")
9394
run(r"Release\app.exe")
9495
run(r"Debug\app.exe")
95-
else:
96+
else:
97+
with chdir("build"):
9698
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -DCMAKE_BUILD_TYPE=Release")
9799
run("cmake --build .")
98100
run("./app")
101+
with chdir("build-multi"):
102+
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G'Ninja Multi-Config'")
103+
run("cmake --build . --config Release")
104+
run("cmake --build . --config Debug")
105+
run("./Release/app")
106+
run("./Debug/app")
99107

100108

0 commit comments

Comments
 (0)