Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Improved naming of variables in detect_host_profile #655

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -358,74 +358,74 @@ endmacro()


function(detect_host_profile output_file)
detect_os(MYOS MYOS_API_LEVEL MYOS_SDK MYOS_SUBSYSTEM MYOS_VERSION)
detect_arch(MYARCH)
detect_compiler(MYCOMPILER MYCOMPILER_VERSION MYCOMPILER_RUNTIME MYCOMPILER_RUNTIME_TYPE)
detect_cxx_standard(MYCXX_STANDARD)
detect_lib_cxx(MYLIB_CXX)
detect_build_type(MYBUILD_TYPE)
detect_os(_os _api_level _sdk _subsystem _version)
detect_arch(_argch)
detect_compiler(_compiler _compiler_version _compiler_runtime _compiler_runtime_type)
detect_cxx_standard(_cxx_standard)
detect_lib_cxx(_lib_cxx)
detect_build_type(_build_type)

set(PROFILE "")
string(APPEND PROFILE "[settings]\n")
if(MYARCH)
string(APPEND PROFILE arch=${MYARCH} "\n")
set(_profile "")
string(APPEND _profile "[settings]\n")
if(_argch)
string(APPEND _profile arch=${_argch} "\n")
endif()
if(MYOS)
string(APPEND PROFILE os=${MYOS} "\n")
if(_os)
string(APPEND _profile os=${_os} "\n")
endif()
if(MYOS_API_LEVEL)
string(APPEND PROFILE os.api_level=${MYOS_API_LEVEL} "\n")
if(_api_level)
string(APPEND _profile os.api_level=${_api_level} "\n")
endif()
if(MYOS_VERSION)
string(APPEND PROFILE os.version=${MYOS_VERSION} "\n")
if(_version)
string(APPEND _profile os.version=${_version} "\n")
endif()
if(MYOS_SDK)
string(APPEND PROFILE os.sdk=${MYOS_SDK} "\n")
if(_sdk)
string(APPEND _profile os.sdk=${_sdk} "\n")
endif()
if(MYOS_SUBSYSTEM)
string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n")
if(_subsystem)
string(APPEND _profile os.subsystem=${_subsystem} "\n")
endif()
if(MYCOMPILER)
string(APPEND PROFILE compiler=${MYCOMPILER} "\n")
if(_compiler)
string(APPEND _profile compiler=${_compiler} "\n")
endif()
if(MYCOMPILER_VERSION)
string(APPEND PROFILE compiler.version=${MYCOMPILER_VERSION} "\n")
if(_compiler_version)
string(APPEND _profile compiler.version=${_compiler_version} "\n")
endif()
if(MYCOMPILER_RUNTIME)
string(APPEND PROFILE compiler.runtime=${MYCOMPILER_RUNTIME} "\n")
if(_compiler_runtime)
string(APPEND _profile compiler.runtime=${_compiler_runtime} "\n")
endif()
if(MYCOMPILER_RUNTIME_TYPE)
string(APPEND PROFILE compiler.runtime_type=${MYCOMPILER_RUNTIME_TYPE} "\n")
if(_compiler_runtime_type)
string(APPEND _profile compiler.runtime_type=${_compiler_runtime_type} "\n")
endif()
if(MYCXX_STANDARD)
string(APPEND PROFILE compiler.cppstd=${MYCXX_STANDARD} "\n")
if(_cxx_standard)
string(APPEND _profile compiler.cppstd=${_cxx_standard} "\n")
endif()
if(MYLIB_CXX)
string(APPEND PROFILE compiler.libcxx=${MYLIB_CXX} "\n")
if(_lib_cxx)
string(APPEND _profile compiler.libcxx=${_lib_cxx} "\n")
endif()
if(MYBUILD_TYPE)
string(APPEND PROFILE "build_type=${MYBUILD_TYPE}\n")
if(_build_type)
string(APPEND _profile "build_type=${_build_type}\n")
endif()

if(NOT DEFINED output_file)
set(_FN "${CMAKE_BINARY_DIR}/profile")
set(_file_name "${CMAKE_BINARY_DIR}/profile")
else()
set(_FN ${output_file})
set(_file_name ${output_file})
endif()

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

# propagate compilers via profile
append_compiler_executables_configuration()

if(MYOS STREQUAL "Android")
string(APPEND PROFILE "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n")
if(_os STREQUAL "Android")
string(APPEND _profile "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n")
endif()

message(STATUS "CMake-Conan: Creating profile ${_FN}")
file(WRITE ${_FN} ${PROFILE})
message(STATUS "CMake-Conan: Profile: \n${PROFILE}")
message(STATUS "CMake-Conan: Creating profile ${_file_name}")
file(WRITE ${_file_name} ${_profile})
message(STATUS "CMake-Conan: Profile: \n${_profile}")
endfunction()


Expand Down
Loading