@@ -50,6 +50,9 @@ function(detect_os os os_api_level os_sdk os_subsystem os_version)
5050 elseif (CMAKE_SYSTEM_NAME MATCHES "^MSYS" )
5151 set (${os} Windows PARENT_SCOPE )
5252 set (${os_subsystem} msys2 PARENT_SCOPE )
53+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
54+ # https://github.com/emscripten-core/emscripten/blob/4.0.6/cmake/Modules/Platform/Emscripten.cmake#L17C1-L17C34
55+ set (${os} Emscripten PARENT_SCOPE )
5356 else ()
5457 set (${os} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE )
5558 endif ()
@@ -123,6 +126,10 @@ function(detect_arch arch)
123126 elseif (host_arch MATCHES "AMD64|amd64|x86_64|x64" )
124127 set (_arch x86_64)
125128 endif ()
129+ if (EMSCRIPTEN)
130+ # https://github.com/emscripten-core/emscripten/blob/4.0.6/cmake/Modules/Platform/Emscripten.cmake#L294C1-L294C80
131+ set (_arch wasm)
132+ endif ()
126133 message (STATUS "CMake-Conan: cmake_system_processor=${_arch} " )
127134 set (${arch} ${_arch} PARENT_SCOPE )
128135endfunction ()
@@ -268,15 +275,15 @@ function(detect_compiler compiler compiler_version compiler_runtime compiler_run
268275
269276 elseif (_compiler MATCHES AppleClang)
270277 set (_compiler "apple-clang" )
271- string (REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION } )
278+ string (REPLACE "." ";" VERSION_LIST ${_compiler_version } )
272279 list (GET VERSION_LIST 0 _compiler_version)
273280 elseif (_compiler MATCHES Clang)
274281 set (_compiler "clang" )
275- string (REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION } )
282+ string (REPLACE "." ";" VERSION_LIST ${_compiler_version } )
276283 list (GET VERSION_LIST 0 _compiler_version)
277284 elseif (_compiler MATCHES GNU)
278285 set (_compiler "gcc" )
279- string (REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION } )
286+ string (REPLACE "." ";" VERSION_LIST ${_compiler_version } )
280287 list (GET VERSION_LIST 0 _compiler_version)
281288 endif ()
282289
0 commit comments