CMakeModules\DetectArchitecture.cmake: Refactor ARCHITECTURE to DYNARMIC_ARCHITECTURE

Don't rely on super-project's definition of ARCHITECTURE
This commit is contained in:
SachinVin 2019-07-20 08:41:42 +05:30
parent 9bcbdacd2b
commit 19b7fba235
2 changed files with 4 additions and 4 deletions

View File

@ -105,10 +105,10 @@ else()
detect_architecture("__x86_64__" x86_64) detect_architecture("__x86_64__" x86_64)
detect_architecture("__aarch64__" Aarch64) detect_architecture("__aarch64__" Aarch64)
endif() endif()
if (NOT DEFINED ARCHITECTURE) if (NOT DEFINED DYNARMIC_ARCHITECTURE)
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.") message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
endif() endif()
message(STATUS "Target architecture: ${ARCHITECTURE}") message(STATUS "Target architecture: ${DYNARMIC_ARCHITECTURE}")
# Include Boost # Include Boost
if (NOT TARGET boost) if (NOT TARGET boost)

View File

@ -1,6 +1,6 @@
include(CheckSymbolExists) include(CheckSymbolExists)
function(detect_architecture symbol arch) function(detect_architecture symbol arch)
if (NOT DEFINED ARCHITECTURE) if (NOT DEFINED DYNARMIC_ARCHITECTURE)
set(CMAKE_REQUIRED_QUIET 1) set(CMAKE_REQUIRED_QUIET 1)
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch}) check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
unset(CMAKE_REQUIRED_QUIET) unset(CMAKE_REQUIRED_QUIET)
@ -8,7 +8,7 @@ function(detect_architecture symbol arch)
# The output variable needs to be unique across invocations otherwise # The output variable needs to be unique across invocations otherwise
# CMake's crazy scope rules will keep it defined # CMake's crazy scope rules will keep it defined
if (ARCHITECTURE_${arch}) if (ARCHITECTURE_${arch})
set(ARCHITECTURE "${arch}" PARENT_SCOPE) set(DYNARMIC_ARCHITECTURE "${arch}" PARENT_SCOPE)
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE) set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
add_definitions(-DARCHITECTURE_${arch}=1) add_definitions(-DARCHITECTURE_${arch}=1)
endif() endif()