diff --git a/conan_provider.cmake b/conan_provider.cmake index 7d0dc6c6..491a5621 100644 --- a/conan_provider.cmake +++ b/conan_provider.cmake @@ -36,37 +36,37 @@ cmake_policy(PUSH) cmake_minimum_required(VERSION 3.24) -function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION) +function(detect_os os os_api_level os_sdk os_subsystem os_version) # 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") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set(${OS} Macos PARENT_SCOPE) + set(${os} Macos PARENT_SCOPE) elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX") - set(${OS} Neutrino PARENT_SCOPE) + set(${os} Neutrino PARENT_SCOPE) elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") - set(${OS} Windows PARENT_SCOPE) - set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE) + set(${os} Windows PARENT_SCOPE) + set(${os_subsystem} cygwin PARENT_SCOPE) elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS") - set(${OS} Windows PARENT_SCOPE) - set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE) + set(${os} Windows PARENT_SCOPE) + set(${os_subsystem} msys2 PARENT_SCOPE) else() - set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE) + set(${os} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Android") if(DEFINED ANDROID_PLATFORM) - string(REGEX MATCH "[0-9]+" _OS_API_LEVEL ${ANDROID_PLATFORM}) + string(REGEX MATCH "[0-9]+" _os_api_level ${ANDROID_PLATFORM}) elseif(DEFINED CMAKE_SYSTEM_VERSION) - set(_OS_API_LEVEL ${CMAKE_SYSTEM_VERSION}) + set(_os_api_level ${CMAKE_SYSTEM_VERSION}) endif() - message(STATUS "CMake-Conan: android api level=${_OS_API_LEVEL}") - set(${OS_API_LEVEL} ${_OS_API_LEVEL} PARENT_SCOPE) + message(STATUS "CMake-Conan: android api level=${_os_api_level}") + set(${os_api_level} ${_os_api_level} PARENT_SCOPE) endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS") # CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja # generators, but just has the original input string for Xcode. if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT}) - set(_OS_SDK ${CMAKE_OSX_SYSROOT}) + set(_os_sdk ${CMAKE_OSX_SYSROOT}) else() if(CMAKE_OSX_SYSROOT MATCHES Simulator) set(apple_platform_suffix simulator) @@ -74,20 +74,20 @@ function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION) set(apple_platform_suffix os) endif() if(CMAKE_OSX_SYSROOT MATCHES AppleTV) - set(_OS_SDK "appletv${apple_platform_suffix}") + set(_os_sdk "appletv${apple_platform_suffix}") elseif(CMAKE_OSX_SYSROOT MATCHES iPhone) - set(_OS_SDK "iphone${apple_platform_suffix}") + set(_os_sdk "iphone${apple_platform_suffix}") elseif(CMAKE_OSX_SYSROOT MATCHES Watch) - set(_OS_SDK "watch${apple_platform_suffix}") + set(_os_sdk "watch${apple_platform_suffix}") endif() endif() - if(DEFINED _OS_SDK) + if(DEFINED os_sdk) message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}") - set(${OS_SDK} ${_OS_SDK} PARENT_SCOPE) + set(${os_sdk} ${_os_sdk} PARENT_SCOPE) endif() if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET) message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}") - set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE) + set(${os_version} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE) endif() endif() endif()