diff --git a/conan_provider.cmake b/conan_provider.cmake index 1d3ca4c4..b90a4a31 100644 --- a/conan_provider.cmake +++ b/conan_provider.cmake @@ -1,7 +1,7 @@ set(CONAN_MINIMUM_VERSION 2.0.5) -function(detect_os OS OS_API_LEVEL OS_VERSION) +function(detect_os OS OS_API_LEVEL OS_VERSION OS_SUBSYSTEM) # it could be cross compilation message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}") if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") @@ -11,6 +11,12 @@ function(detect_os OS OS_API_LEVEL OS_VERSION) set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") set(${OS} Neutrino PARENT_SCOPE) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN") + set(${OS} Windows PARENT_SCOPE) + set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "MSYS2") + set(${OS} Windows PARENT_SCOPE) + set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE) else() set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE) endif() @@ -24,11 +30,11 @@ endfunction() function(detect_arch ARCH) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64") set(_ARCH armv8) - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l") set(_ARCH armv7) - elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686") set(_ARCH x86) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64") set(_ARCH x86_64) @@ -103,7 +109,7 @@ endfunction() function(detect_host_profile output_file) - detect_os(MYOS MYOS_API_LEVEL MYOS_VERSION) + detect_os(MYOS MYOS_API_LEVEL MYOS_VERSION MYOS_SUBSYSTEM) detect_arch(MYARCH) detect_compiler(MYCOMPILER MYCOMPILER_VERSION) detect_cxx_standard(MYCXX_STANDARD) @@ -125,6 +131,9 @@ function(detect_host_profile output_file) if(MYOS_VERSION) string(APPEND PROFILE os.version=${MYOS_VERSION} "\n") endif() + if(MYOS_SUBSYSTEM) + string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n") + endif() if(MYCOMPILER) string(APPEND PROFILE compiler=${MYCOMPILER} "\n") endif()