mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[CMAKE] Require ARCH variable to be specified explicitly
Also, use CMAKE_TRY_COMPILE_PLATFORM_VARIABLES in toolchain files to solve issues with ARCH not being passed during try_compile
This commit is contained in:
parent
72ad37c1cd
commit
f0b53998c8
4 changed files with 15 additions and 14 deletions
|
@ -28,8 +28,9 @@ set(CMAKE_C_STANDARD 99)
|
|||
set(CMAKE_CXX_STANDARD 11)
|
||||
#set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||
|
||||
# check that the ARCH (target architecture) variable is defined
|
||||
if(NOT ARCH)
|
||||
set(ARCH i386)
|
||||
message(FATAL_ERROR "Target architecture (ARCH) is not defined. Please, choose one of: i386, amd64, arm")
|
||||
endif()
|
||||
# Now the ARCH variable will be in lowercase.
|
||||
# It is needed because STREQUAL comparison
|
||||
|
@ -38,6 +39,9 @@ endif()
|
|||
# for more information.
|
||||
string(TOLOWER ${ARCH} ARCH)
|
||||
|
||||
# set possible values for cmake GUI
|
||||
set_property(CACHE ARCH PROPERTY STRINGS "i386" "amd64" "arm")
|
||||
|
||||
# Alternative WinNT-compatible architecture string
|
||||
if(ARCH STREQUAL "i386")
|
||||
set(WINARCH "x86")
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
if(NOT ARCH)
|
||||
set(ARCH i386)
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{_ROSBE_ROSSCRIPTDIR})
|
||||
set(CMAKE_SYSROOT $ENV{_ROSBE_ROSSCRIPTDIR}/$ENV{ROS_ARCH})
|
||||
endif()
|
||||
|
||||
# pass variables necessary for the toolchain (needed for try_compile)
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH CLANG_VERSION)
|
||||
|
||||
# The name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
# The processor we are targeting
|
||||
|
@ -17,7 +16,7 @@ elseif (ARCH STREQUAL "amd64")
|
|||
elseif(ARCH STREQUAL "arm")
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
else()
|
||||
message(ERROR "Unsupported ARCH: ${ARCH}")
|
||||
message(FATAL_ERROR "Unsupported ARCH: ${ARCH}")
|
||||
endif()
|
||||
|
||||
if (DEFINED CLANG_VERSION)
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
if(NOT ARCH)
|
||||
set(ARCH i386)
|
||||
endif()
|
||||
|
||||
# Default to Debug for the build type
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif()
|
||||
|
||||
# pass variables necessary for the toolchain (needed for try_compile)
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH)
|
||||
|
||||
# Choose the right MinGW toolchain prefix
|
||||
if(NOT DEFINED MINGW_TOOLCHAIN_PREFIX)
|
||||
if(ARCH STREQUAL "i386")
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
if(NOT ARCH)
|
||||
set(ARCH i386)
|
||||
endif()
|
||||
|
||||
# Default to Debug for the build type
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif()
|
||||
|
||||
# pass variables necessary for the toolchain (needed for try_compile)
|
||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH USE_CLANG_CL)
|
||||
|
||||
# the name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||
|
|
Loading…
Reference in a new issue