Skip to content

Commit

Permalink
Don't unset CMAKE_CROSSCOMPILING when cross-compiling to linux (micro…
Browse files Browse the repository at this point in the history
  • Loading branch information
JAicewizard authored Jul 11, 2024
1 parent 4de4372 commit 3f530d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/toolchains/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")
Expand Down Expand Up @@ -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} ")
Expand Down

0 comments on commit 3f530d4

Please sign in to comment.