Skip to content

Commit

Permalink
Merge pull request #122 from lambtonr/main
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 27, 2022
2 parents 0a0bac0 + 90c5eb5 commit 6fc988c
Showing 1 changed file with 46 additions and 36 deletions.
82 changes: 46 additions & 36 deletions src/Conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,46 +33,56 @@ macro(run_conan)
URL
https://bincrafters.jfrog.io/artifactory/api/conan/public-conan)

# For multi configuration generators, like VS and XCode
if(NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Single configuration build!")
set(LIST_OF_BUILD_TYPES ${CMAKE_BUILD_TYPE})
if(CONAN_EXPORTED)
# standard conan installation, in which deps will be defined in conanfile. It is not necessary to call conan again, as it is already running.
if (EXISTS "${CMAKE_BINARY_DIR}/../conanbuildinfo.cmake")
include(${CMAKE_BINARY_DIR}/../conanbuildinfo.cmake)
else()
message(FATAL_ERROR "Could not set up conan because \"${CMAKE_BINARY_DIR}/../conanbuildinfo.cmake\" does not exist")
endif()
conan_basic_setup()
else()
message(STATUS "Multi-configuration build: '${CMAKE_CONFIGURATION_TYPES}'!")
set(LIST_OF_BUILD_TYPES ${CMAKE_CONFIGURATION_TYPES})
endif()
# For multi configuration generators, like VS and XCode
if(NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Single configuration build!")
set(LIST_OF_BUILD_TYPES ${CMAKE_BUILD_TYPE})
else()
message(STATUS "Multi-configuration build: '${CMAKE_CONFIGURATION_TYPES}'!")
set(LIST_OF_BUILD_TYPES ${CMAKE_CONFIGURATION_TYPES})
endif()

is_verbose(_is_verbose)
if(NOT ${_is_verbose})
set(OUTPUT_QUIET "OUTPUT_QUIET")
else()
set(OUTPUT_QUIET OFF)
endif()
is_verbose(_is_verbose)
if(NOT ${_is_verbose})
set(OUTPUT_QUIET "OUTPUT_QUIET")
else()
set(OUTPUT_QUIET OFF)
endif()

foreach(TYPE ${LIST_OF_BUILD_TYPES})
message(STATUS "Running Conan for build type '${TYPE}'")
foreach(TYPE ${LIST_OF_BUILD_TYPES})
message(STATUS "Running Conan for build type '${TYPE}'")

# Detects current build settings to pass into conan
conan_cmake_autodetect(settings BUILD_TYPE ${TYPE})
# Detects current build settings to pass into conan
conan_cmake_autodetect(settings BUILD_TYPE ${TYPE})

# PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR} is used to tell conan to process
# the external "conanfile.py" provided with the project
# Alternatively a conanfile.txt could be used
conan_cmake_install(
PATH_OR_REFERENCE
${CMAKE_SOURCE_DIR}
BUILD
missing
# Pass compile-time configured options into conan
OPTIONS
${ProjectOptions_CONAN_OPTIONS}
# Pass CMake compilers to Conan
ENV
"CC=${CMAKE_C_COMPILER}"
"CXX=${CMAKE_CXX_COMPILER}"
SETTINGS
${settings}
${OUTPUT_QUIET})
endforeach()
# PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR} is used to tell conan to process
# the external "conanfile.py" provided with the project
# Alternatively a conanfile.txt could be used
conan_cmake_install(
PATH_OR_REFERENCE
${CMAKE_SOURCE_DIR}
BUILD
missing
# Pass compile-time configured options into conan
OPTIONS
${ProjectOptions_CONAN_OPTIONS}
# Pass CMake compilers to Conan
ENV
"CC=${CMAKE_C_COMPILER}"
"CXX=${CMAKE_CXX_COMPILER}"
SETTINGS
${settings}
${OUTPUT_QUIET})
endforeach()
endif()

endmacro()

0 comments on commit 6fc988c

Please sign in to comment.