1bedd3bd7f
Moves functions out of the main CMakeLists file into module files that can just be included whenever necessary. This also uses the CMake provided variables for enforcing compiler requirements.
16 lines
612 B
CMake
16 lines
612 B
CMake
include(CheckSymbolExists)
|
|
function(detect_architecture symbol arch)
|
|
if (NOT DEFINED ARCHITECTURE)
|
|
set(CMAKE_REQUIRED_QUIET 1)
|
|
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
|
|
unset(CMAKE_REQUIRED_QUIET)
|
|
|
|
# The output variable needs to be unique across invocations otherwise
|
|
# CMake's crazy scope rules will keep it defined
|
|
if (ARCHITECTURE_${arch})
|
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
|
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
|
add_definitions(-DARCHITECTURE_${arch}=1)
|
|
endif()
|
|
endif()
|
|
endfunction()
|