enable_language: Establish target platform identification variables earlier
Set target platform identification variables like `APPLE` and `LINUX` as soon as the target system is identified. This makes them available during toolchain and binutils selection. Fixes: #23333
This commit is contained in:
parent
1d916bf3d2
commit
1373373823
@ -6,19 +6,6 @@
|
||||
# It is included after the compiler has been determined, so
|
||||
# we know things like the compiler name and if the compiler is gnu.
|
||||
|
||||
# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
|
||||
# done to keep scripts and custom language and compiler modules working.
|
||||
# But they are reset here and set again in the platform files for the target
|
||||
# platform, so they can be used for testing the target platform instead
|
||||
# of testing the host platform.
|
||||
set(APPLE )
|
||||
set(UNIX )
|
||||
set(CYGWIN )
|
||||
set(MSYS )
|
||||
set(WIN32 )
|
||||
set(BSD )
|
||||
set(LINUX )
|
||||
|
||||
function(_cmake_record_install_prefix )
|
||||
set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
|
||||
set(_CMAKE_SYSTEM_PREFIX_PATH_STAGING_PREFIX_VALUE "${CMAKE_STAGING_PREFIX}" PARENT_SCOPE)
|
||||
|
@ -5,6 +5,19 @@
|
||||
# This file is included by cmGlobalGenerator::EnableLanguage.
|
||||
# It is included before the compiler has been determined.
|
||||
|
||||
# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
|
||||
# done to keep scripts and custom language and compiler modules working.
|
||||
# But they are reset here and set again in the platform files for the target
|
||||
# platform, so they can be used for testing the target platform instead
|
||||
# of testing the host platform.
|
||||
unset(APPLE)
|
||||
unset(UNIX)
|
||||
unset(CYGWIN)
|
||||
unset(MSYS)
|
||||
unset(WIN32)
|
||||
unset(BSD)
|
||||
unset(LINUX)
|
||||
|
||||
# The CMAKE_EFFECTIVE_SYSTEM_NAME is used to load compiler and compiler
|
||||
# wrapper configuration files. By default it equals to CMAKE_SYSTEM_NAME
|
||||
# but could be overridden in the ${CMAKE_SYSTEM_NAME}-Initialize files.
|
||||
|
1
Modules/Platform/AIX-Initialize.cmake
Normal file
1
Modules/Platform/AIX-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
@ -23,6 +23,11 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(Platform/Linux-Initialize)
|
||||
unset(LINUX)
|
||||
|
||||
set(ANDROID 1)
|
||||
|
||||
set(CMAKE_BUILD_TYPE_INIT "RelWithDebInfo")
|
||||
|
||||
if(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED)
|
||||
|
@ -4,11 +4,6 @@ if(CMAKE_ANDROID_NDK)
|
||||
include(${CMAKE_ANDROID_NDK}/build/cmake/hooks/pre/Android.cmake OPTIONAL)
|
||||
endif()
|
||||
|
||||
include(Platform/Linux)
|
||||
unset(LINUX)
|
||||
|
||||
set(ANDROID 1)
|
||||
|
||||
# Natively compiling on an Android host doesn't need these flags to be reset.
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Android")
|
||||
return()
|
||||
|
1
Modules/Platform/BSDOS-Initialize.cmake
Normal file
1
Modules/Platform/BSDOS-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/BeOS-Initialize.cmake
Normal file
2
Modules/Platform/BeOS-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(BEOS 1)
|
||||
set(UNIX 1)
|
@ -1,5 +1,3 @@
|
||||
set(BEOS 1)
|
||||
|
||||
set(CMAKE_DL_LIBS root be)
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
|
1
Modules/Platform/BlueGeneL-Initialize.cmake
Normal file
1
Modules/Platform/BlueGeneL-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
@ -49,11 +49,6 @@ set(CMAKE_SYSTEM_IGNORE_PATH
|
||||
/usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include
|
||||
)
|
||||
|
||||
#
|
||||
# Indicate that this is a unix-like system
|
||||
#
|
||||
set(UNIX 1)
|
||||
|
||||
#
|
||||
# Library prefixes, suffixes, extra libs.
|
||||
#
|
||||
|
1
Modules/Platform/BlueGeneP-dynamic-Initialize.cmake
Normal file
1
Modules/Platform/BlueGeneP-dynamic-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/BlueGeneP-static-Initialize.cmake
Normal file
1
Modules/Platform/BlueGeneP-static-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
@ -39,11 +39,6 @@ set(CMAKE_SYSTEM_IGNORE_PATH
|
||||
/usr/X11R7/lib /usr/X11R7/lib64 /usr/X11R7/include
|
||||
)
|
||||
|
||||
#
|
||||
# Indicate that this is a unix-like system
|
||||
#
|
||||
set(UNIX 1)
|
||||
|
||||
#
|
||||
# Library prefixes, suffixes, extra libs.
|
||||
#
|
||||
|
1
Modules/Platform/BlueGeneQ-dynamic-Initialize.cmake
Normal file
1
Modules/Platform/BlueGeneQ-dynamic-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/BlueGeneQ-static-Initialize.cmake
Normal file
1
Modules/Platform/BlueGeneQ-static-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/CYGWIN-Initialize.cmake
Normal file
2
Modules/Platform/CYGWIN-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(CYGWIN 1)
|
||||
set(UNIX 1)
|
@ -1,5 +1,3 @@
|
||||
set(CYGWIN 1)
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "cyg")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
|
||||
set(CMAKE_SHARED_MODULE_PREFIX "cyg")
|
||||
|
1
Modules/Platform/Catamount-Initialize.cmake
Normal file
1
Modules/Platform/Catamount-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
4
Modules/Platform/CrayLinuxEnvironment-Initialize.cmake
Normal file
4
Modules/Platform/CrayLinuxEnvironment-Initialize.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
|
||||
# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
|
||||
|
||||
set(UNIX 1)
|
@ -1,8 +1,6 @@
|
||||
# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
|
||||
# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
|
||||
|
||||
set(UNIX 1)
|
||||
|
||||
if(DEFINED ENV{CRAYOS_VERSION})
|
||||
set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}")
|
||||
elseif(DEFINED ENV{XTOS_VERSION})
|
||||
|
1
Modules/Platform/DOS-Initialize.cmake
Normal file
1
Modules/Platform/DOS-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(DOS 1)
|
@ -1,5 +1,3 @@
|
||||
set(DOS 1)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
|
@ -1,3 +1,6 @@
|
||||
set(APPLE 1)
|
||||
set(UNIX 1)
|
||||
|
||||
# Ask xcode-select where to find /Developer or fall back to ancient location.
|
||||
execute_process(COMMAND xcode-select -print-path
|
||||
OUTPUT_VARIABLE _stdout
|
||||
|
@ -1,5 +1,3 @@
|
||||
set(APPLE 1)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
|
||||
if(NOT DEFINED CMAKE_MACOSX_BUNDLE)
|
||||
set(CMAKE_MACOSX_BUNDLE ON)
|
||||
|
2
Modules/Platform/DragonFly-Initialize.cmake
Normal file
2
Modules/Platform/DragonFly-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Platform/FreeBSD-Initialize)
|
||||
set(BSD "DragonFlyBSD")
|
@ -3,7 +3,6 @@
|
||||
# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361
|
||||
|
||||
include(Platform/FreeBSD)
|
||||
set(BSD "DragonFlyBSD")
|
||||
|
||||
# DragonFly BSD requires -z origin to enable $ORIGIN expansion in RPATH.
|
||||
# This is not required for FreeBSD since 10.2-RELEASE.
|
||||
|
2
Modules/Platform/FreeBSD-Initialize.cmake
Normal file
2
Modules/Platform/FreeBSD-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(BSD "FreeBSD")
|
||||
set(UNIX 1)
|
@ -1,4 +1,3 @@
|
||||
set(BSD "FreeBSD")
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
|
1
Modules/Platform/Fuchsia-Initialize.cmake
Normal file
1
Modules/Platform/Fuchsia-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(FUCHSIA 1)
|
@ -1,5 +1,3 @@
|
||||
set(FUCHSIA 1)
|
||||
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
|
@ -1 +1,3 @@
|
||||
set(UNIX 1)
|
||||
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-gnu[a-z0-9_]*")
|
||||
|
1
Modules/Platform/HP-UX-Initialize.cmake
Normal file
1
Modules/Platform/HP-UX-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/Haiku-Initialize.cmake
Normal file
2
Modules/Platform/Haiku-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(HAIKU 1)
|
||||
set(UNIX 1)
|
@ -1,6 +1,3 @@
|
||||
set(HAIKU 1)
|
||||
set(UNIX 1)
|
||||
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
|
||||
|
@ -1,2 +1,5 @@
|
||||
set(LINUX 1)
|
||||
set(UNIX 1)
|
||||
|
||||
# Match multiarch library directory names.
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-linux-gnu[a-z0-9_]*")
|
||||
|
@ -1,4 +1,3 @@
|
||||
set(LINUX 1)
|
||||
set(CMAKE_DL_LIBS "dl")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
||||
|
1
Modules/Platform/MP-RAS-Initialize.cmake
Normal file
1
Modules/Platform/MP-RAS-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/MSYS-Initialize.cmake
Normal file
2
Modules/Platform/MSYS-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(MSYS 1)
|
||||
include(Platform/CYGWIN-Initialize)
|
@ -1,4 +1,3 @@
|
||||
set(MSYS 1)
|
||||
include(Platform/CYGWIN)
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "msys-")
|
||||
set(CMAKE_SHARED_MODULE_PREFIX "msys-")
|
||||
|
1
Modules/Platform/Midipix-Initialize.cmake
Normal file
1
Modules/Platform/Midipix-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/NetBSD-Initialize.cmake
Normal file
2
Modules/Platform/NetBSD-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(BSD "NetBSD")
|
||||
set(UNIX 1)
|
@ -1,4 +1,3 @@
|
||||
set(BSD "NetBSD")
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
|
1
Modules/Platform/OSF1-Initialize.cmake
Normal file
1
Modules/Platform/OSF1-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/OpenBSD-Initialize.cmake
Normal file
2
Modules/Platform/OpenBSD-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Platform/NetBSD-Initialize)
|
||||
set(BSD "OpenBSD")
|
@ -1,5 +1,4 @@
|
||||
include(Platform/NetBSD)
|
||||
set(BSD "OpenBSD")
|
||||
|
||||
# On OpenBSD, the compile time linker does not share it's configuration with
|
||||
# the runtime linker. This will extract the library search paths from the
|
||||
|
1
Modules/Platform/OpenVMS-Initialize.cmake
Normal file
1
Modules/Platform/OpenVMS-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
@ -1,2 +1,3 @@
|
||||
set(QNXNTO 1)
|
||||
include(Platform/GNU-Initialize)
|
||||
unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
|
||||
|
@ -1,5 +1,3 @@
|
||||
set(QNXNTO 1)
|
||||
|
||||
include(Platform/GNU)
|
||||
|
||||
set(CMAKE_DL_LIBS "")
|
||||
|
1
Modules/Platform/RISCos-Initialize.cmake
Normal file
1
Modules/Platform/RISCos-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/SCO_SV-Initialize.cmake
Normal file
1
Modules/Platform/SCO_SV-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/SINIX-Initialize.cmake
Normal file
1
Modules/Platform/SINIX-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
2
Modules/Platform/SerenityOS-Initialize.cmake
Normal file
2
Modules/Platform/SerenityOS-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(SERENITYOS 1)
|
||||
set(UNIX 1)
|
@ -1,6 +1,3 @@
|
||||
|
||||
set(SERENITYOS 1)
|
||||
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||
|
1
Modules/Platform/SunOS-Initialize.cmake
Normal file
1
Modules/Platform/SunOS-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/Tru64-Initialize.cmake
Normal file
1
Modules/Platform/Tru64-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/ULTRIX-Initialize.cmake
Normal file
1
Modules/Platform/ULTRIX-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/UNIX_SV-Initialize.cmake
Normal file
1
Modules/Platform/UNIX_SV-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
@ -12,6 +12,9 @@ if(__UNIX_PATHS_INCLUDED)
|
||||
endif()
|
||||
set(__UNIX_PATHS_INCLUDED 1)
|
||||
|
||||
# Since CMake 3.27, the Platform/<os>-Initialize modules set UNIX
|
||||
# if the corresponding Platform/<os> modules includes UnixPaths.
|
||||
# Retain the setting here to support externally-maintained platform modules.
|
||||
set(UNIX 1)
|
||||
|
||||
# also add the install directory of the running cmake to the search directories
|
||||
|
1
Modules/Platform/UnixWare-Initialize.cmake
Normal file
1
Modules/Platform/UnixWare-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/Windows-Initialize.cmake
Normal file
1
Modules/Platform/Windows-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(WIN32 1)
|
@ -1,13 +1,3 @@
|
||||
set(WIN32 1)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
|
||||
set(WINCE 1)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
|
||||
set(WINDOWS_PHONE 1)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(WINDOWS_STORE 1)
|
||||
endif()
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
|
||||
|
2
Modules/Platform/WindowsCE-Initialize.cmake
Normal file
2
Modules/Platform/WindowsCE-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Platform/Windows-Initialize)
|
||||
set(WINCE 1)
|
2
Modules/Platform/WindowsPhone-Initialize.cmake
Normal file
2
Modules/Platform/WindowsPhone-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Platform/Windows-Initialize)
|
||||
set(WINDOWS_PHONE 1)
|
2
Modules/Platform/WindowsStore-Initialize.cmake
Normal file
2
Modules/Platform/WindowsStore-Initialize.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include(Platform/Windows-Initialize)
|
||||
set(WINDOWS_STORE 1)
|
1
Modules/Platform/Xenix-Initialize.cmake
Normal file
1
Modules/Platform/Xenix-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/eCos-Initialize.cmake
Normal file
1
Modules/Platform/eCos-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
1
Modules/Platform/syllable-Initialize.cmake
Normal file
1
Modules/Platform/syllable-Initialize.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(UNIX 1)
|
Loading…
Reference in New Issue
Block a user