cmake/canonical_host.cmake
2017-01-17 19:20:12 +11:00

22 lines
723 B
CMake

macro (canonical_host)
if (NOT __test_canonical_host)
message (STATUS "checking the host CPU")
execute_process (
COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
RESULT_VARIABLE __canonical_host_result
OUTPUT_VARIABLE __canonical_host_output
)
if (${__canonical_host_result})
message (FATAL_ERROR "unable to query for canonical host")
endif (${__canonical_host_result})
string(REGEX MATCH "^([^-\]+)" HOST_CPU ${__canonical_host_output})
message (STATUS "checking the host CPU - found '${HOST_CPU}'")
endif (NOT __test_canonical_host)
set (__test_canonical_host 1 INTERNAL)
endmacro (canonical_host)