Don't unset CMAKE_CROSSCOMPILING when cross-compiling to linux (#37734)

This commit is contained in:
Jaap Aarts 2024-07-12 00:47:43 +02:00 committed by GitHub
parent 4de4372b5b
commit 3f530d4827
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,9 +21,6 @@ if(NOT _VCPKG_LINUX_TOOLCHAIN)
VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG
)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
set(CMAKE_SYSTEM_NAME Linux CACHE STRING "")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64 CACHE STRING "")
@ -70,6 +67,10 @@ if(NOT _VCPKG_LINUX_TOOLCHAIN)
endif()
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR)
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")