Skip to content

Commit

Permalink
Merge pull request #476 from jcar87/lcc/experimental/dep-provider-gen…
Browse files Browse the repository at this point in the history
…erator-logic

dep provider: fixes
  • Loading branch information
jcar87 authored Mar 13, 2023
2 parents 1f33316 + e2bb886 commit 82b04f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 13 additions & 1 deletion conantools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ function(detect_compiler COMPILER COMPILER_VERSION)
set(_COMPILER "apple-clang")
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
list(GET VERSION_LIST 0 _COMPILER_VERSION)
elseif(_COMPILER MATCHES Clang)
set(_COMPILER "clang")
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
list(GET VERSION_LIST 0 _COMPILER_VERSION)
elseif(_COMPILER MATCHES GNU)
set(_COMPILER "gcc")
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
list(GET VERSION_LIST 0 _COMPILER_VERSION)
endif()

message(STATUS "Conan-cmake: [settings] compiler=${_COMPILER}")
Expand Down Expand Up @@ -91,6 +99,10 @@ function(detect_host_profile output_file)
else()
set(_FN ${output_file})
endif()

string(APPEND PROFILE "[conf]\n")
string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n")

message(STATUS "Conan-cmake: Creating profile ${_FN}")
file(WRITE ${_FN} ${PROFILE})
message(STATUS "Conan-cmake: Profile: \n${PROFILE}")
Expand Down Expand Up @@ -128,7 +140,7 @@ function(conan_provide_dependency package_name)
if(NOT CONAN_INSTALL_SUCCESS)
message(STATUS "CMake-conan: first find_package() found, running 'conan install' to install deps")
detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile)
if(CMAKE_BUILD_TYPE)
if(NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "CMake-conan: Intalling single configuration ${CMAKE_BUILD_TYPE}")
conan_install(-pr ${CMAKE_BINARY_DIR}/conan_host_profile --build=missing -g CMakeDeps)
else()
Expand Down
14 changes: 11 additions & 3 deletions tests_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,24 @@ def test1():
shutil.copy2(os.path.join(os.path.dirname(__file__), "conan_provider.cmake"), ".")
shutil.copy2(os.path.join(os.path.dirname(__file__), "conaninstall.cmake"), ".")
shutil.copy2(os.path.join(os.path.dirname(__file__), "conantools.cmake"), ".")
with chdir("build"):
if platform.system() == "Windows":

if platform.system() == "Windows":
with chdir("build"):
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake")
run("cmake --build . --config Release")
run("cmake --build . --config Debug")
run(r"Release\app.exe")
run(r"Debug\app.exe")
else:
else:
with chdir("build"):
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -DCMAKE_BUILD_TYPE=Release")
run("cmake --build .")
run("./app")
with chdir("build-multi"):
run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G'Ninja Multi-Config'")
run("cmake --build . --config Release")
run("cmake --build . --config Debug")
run("./Release/app")
run("./Debug/app")


0 comments on commit 82b04f2

Please sign in to comment.