From 60c620c28cb79899ceea2200847b6f2cbc5d1724 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 23 Mar 2021 11:28:16 +0100 Subject: [PATCH] Fix libraries names when cross compiling on Linux using CMake This allows using wxWidgets libraries from CMake when cross-compiling too. Closes https://github.com/wxWidgets/wxWidgets/pull/2291 --- build/cmake/functions.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index d3a9fbc78a..871e681e51 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -210,12 +210,17 @@ function(wx_set_target_properties target_name is_base) "-DWXDLLNAME=wx${lib_toolkit}${dll_version}${lib_unicode}$<$:d>${dll_suffix}") endif() else() + set(cross_target "") + if (CMAKE_CROSSCOMPILING AND NOT IPHONE) + set(cross_target "-${CMAKE_SYSTEM_NAME}") + endif () + set_target_properties(${target_name} PROPERTIES - OUTPUT_NAME wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version} + OUTPUT_NAME wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version}${cross_target} # NOTE: wx-config can not be used to connect the libraries with the debug suffix. #OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}d${lib_flavour}${lib_suffix}-${lib_version} - OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version} + OUTPUT_NAME_DEBUG wx_${lib_toolkit}${lib_unicode}${lib_flavour}${lib_suffix}-${lib_version}${cross_target} ) endif() if(CYGWIN)