[oe-commits] [openembedded-core] 01/08: cmake: fix linking in multilib SDKs

git at git.openembedded.org git at git.openembedded.org
Fri Aug 3 15:16:45 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 4742f7af45252082f84e6c305bd124a4133cee6a
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Fri Aug 3 15:01:12 2018 +0100

    cmake: fix linking in multilib SDKs
    
    CMake, in it's infinite wisdom, when searching for libraries (using
    find_library) will look inside the libraries PREFIX/lib, PREFIX/lib32, and
    PREFIX/lib64.  In a multilib SDK more than one of these will exist (potentially
    all three) and obviously for a given build configuration only one of those is
    valid.  This search path is hard-coded deep inside CMake but by setting
    CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX we can bypass it and set an explicit
    lib<SUFFIX> to use.
    
    Do this by writing ${baselib} into the environment file, and then stripping
    "lib" from this to obtain the suffix in the cmake-specific environment script,
    which is then read in the CMake toolchain.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/toolchain-scripts.bbclass                    | 1 +
 meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 2 ++
 meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 0ff5301..63b07c8 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -51,6 +51,7 @@ toolchain_create_sdk_env_script () {
 	echo "export OECORE_NATIVE_SYSROOT=\"$sdkpathnative\"" >> $script
 	echo 'export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"' >> $script
 	echo "export OECORE_ACLOCAL_OPTS=\"-I $sdkpathnative/usr/share/aclocal\"" >> $script
+	echo 'export OECORE_BASELIB="${baselib}"' >> $script
 	echo 'unset command_not_found_handle' >> $script
 
 	toolchain_shared_env_script
diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
index dc8477e..d52c29e 100644
--- a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
+++ b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake
@@ -10,6 +10,8 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
 
+set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")
+
 # Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
 if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
   set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
diff --git a/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh b/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh
index 64b6cf3..7bdb19f 100644
--- a/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh
+++ b/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh
@@ -1 +1,2 @@
 export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake"
+export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list