File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -479,8 +479,28 @@ if (DEPS_DIR)
479
479
endif ()
480
480
endif ()
481
481
482
+ # Find libraries when cross-compiling on Linux systems.
483
+ # We purposedly do not use LINUX for two reasons:
484
+ # - We're not testing for the target but for the system running the compiler,
485
+ # - It should exclude Android.
486
+ if (CMAKE_SYSTEM_NAME MATCHES "Linux" )
487
+ # This code setting MACHINE_TRIPLE may be moved to DaemonArchitecture.
488
+ execute_process (COMMAND "${CMAKE_CXX_COMPILER} " -dumpmachine
489
+ OUTPUT_VARIABLE MACHINE_TRIPLE
490
+ OUTPUT_STRIP_TRAILING_WHITESPACE
491
+ )
492
+
493
+ if (MACHINE_TRIPLE )
494
+ set (MACHINE_ROOT_PATH "/usr/${MACHINE_TRIPLE} " )
495
+
496
+ if (NOT IS_DIRECTORY "${MACHINE_ROOT_PATH} " )
497
+ unset (MACHINE_ROOT_PATH )
498
+ endif ()
499
+ endif ()
500
+ endif ()
501
+
482
502
# Add to paths
483
- set (CMAKE_FIND_ROOT_PATH ${DEPS_DIR} ${CMAKE_FIND_ROOT_PATH} )
503
+ set (CMAKE_FIND_ROOT_PATH ${DEPS_DIR} ${CMAKE_FIND_ROOT_PATH} ${MACHINE_ROOT_PATH} )
484
504
set (CMAKE_INCLUDE_PATH ${DEPS_DIR} ${DEPS_DIR} /include ${CMAKE_INCLUDE_PATH} )
485
505
set (CMAKE_FRAMEWORK_PATH ${DEPS_DIR} ${CMAKE_FRAMEWORK_PATH} )
486
506
set (CMAKE_PREFIX_PATH ${DEPS_DIR} ${CMAKE_PREFIX_PATH} )
You can’t perform that action at this time.
0 commit comments