diff options
author | Ross Burton <ross.burton@intel.com> | 2018-08-03 15:01:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-07 12:13:03 +0100 |
commit | 05f2bf79700b3f745417bc0b27cf636db650928a (patch) | |
tree | 4e7a981584c17f3ac0d57ca0ed98bf90293eb6c8 /meta/recipes-devtools/cmake | |
parent | bf02f255def72584a4437efafb50a8325ad8364e (diff) | |
download | poky-05f2bf79700b3f745417bc0b27cf636db650928a.tar.gz |
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.
(From OE-Core rev: 47160a8c51310f2b40cabf4c1910b5df6e0a15d6)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/cmake')
-rw-r--r-- | meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake index dc8477ea34..d52c29e5a1 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 ) | |||
10 | set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) | 10 | set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) |
11 | set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY ) | 11 | set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY ) |
12 | 12 | ||
13 | set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}") | ||
14 | |||
13 | # Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os). | 15 | # Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os). |
14 | if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+") | 16 | if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+") |
15 | set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1}) | 17 | 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 64b6cf3c6a..7bdb19fb6c 100644 --- a/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh +++ b/meta/recipes-devtools/cmake/cmake/environment.d-cmake.sh | |||
@@ -1 +1,2 @@ | |||
1 | export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" | 1 | export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" |
2 | export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`" | ||