diff options
author | Christian Schmidbauer <ch.schmidbauer@gmail.com> | 2017-02-25 18:47:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-01 14:49:42 (GMT) |
commit | 503f25d490e56dfc1d3dc894e1fc1bd3e7e89e81 (patch) | |
tree | c5e35271ce09ec7fba4fcef5d176ed17676470e9 /Tests/CMakeOnly/find_library | |
parent | 78104bd7bca4bd9b4b7a5c17622838a33843138e (diff) | |
download | CMake-503f25d490e56dfc1d3dc894e1fc1bd3e7e89e81.zip CMake-503f25d490e56dfc1d3dc894e1fc1bd3e7e89e81.tar.gz CMake-503f25d490e56dfc1d3dc894e1fc1bd3e7e89e81.tar.bz2 |
find_library: Allow custom lib suffix be used as find path
Add a new `CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX` variable to allow use
of a custom suffix on `lib` directory names. This is a more general
option than that added by commit v3.7.0-rc1~504^2 (Teach find_library
and find_package to search lib32 paths, 2016-06-10). It allows the find
path to be more deterministic on custom setups.
See discussion in #10287 and #15994.
Diffstat (limited to 'Tests/CMakeOnly/find_library')
7 files changed, 14 insertions, 1 deletions
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt index 9958650..9c1aad8 100644 --- a/Tests/CMakeOnly/find_library/CMakeLists.txt +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -24,7 +24,7 @@ endmacro() macro(test_find_library_subst expected) get_filename_component(dir ${expected} PATH) get_filename_component(name ${expected} NAME) - string(REGEX REPLACE "lib/?64" "lib" dir "${dir}") + string(REGEX REPLACE "lib/?[36X][24Y][Z]*" "lib" dir "${dir}") test_find_library(", searched as ${dir}" "${expected}" NAMES ${name} PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir} @@ -79,3 +79,16 @@ test_find_library("" A/libtestA.a NAMES testB testA NAMES_PER_DIR PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B ) + +set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "XYZ") +foreach(libXYZ + lib/XYZ/libtest1.a + lib/A/libXYZ/libtest2.a + lib/libtest3.a + libXYZ/A/lib/libtest4.a + libXYZ/A/libXYZ/libtest5.a + libXYZ/A/libtest6.a + libXYZ/libtest7.a + ) + test_find_library_subst(${libXYZ}) +endforeach() diff --git a/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a b/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/A/libXYZ/libtest2.a diff --git a/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a b/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/XYZ/libtest1.a diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a b/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/libXYZ/A/lib/libtest4.a diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a b/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/libXYZ/A/libXYZ/libtest5.a diff --git a/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a b/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/libXYZ/A/libtest6.a diff --git a/Tests/CMakeOnly/find_library/libXYZ/libtest7.a b/Tests/CMakeOnly/find_library/libXYZ/libtest7.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/libXYZ/libtest7.a |