diff options
author | David Cole <david.cole@kitware.com> | 2012-08-13 17:26:57 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-08-13 17:26:57 (GMT) |
commit | 85f843a7b4aaf1b25e1e1e60ecdae3a3e2d7a9cb (patch) | |
tree | f25dae6a02680f4659322e65a54e5b421d900aea /Tests | |
parent | e93d9c5c2b8095cf94ebb92763604db0108e0818 (diff) | |
parent | af80da349bb259ccccac146cdd734afeedeec116 (diff) | |
download | CMake-85f843a7b4aaf1b25e1e1e60ecdae3a3e2d7a9cb.zip CMake-85f843a7b4aaf1b25e1e1e60ecdae3a3e2d7a9cb.tar.gz CMake-85f843a7b4aaf1b25e1e1e60ecdae3a3e2d7a9cb.tar.bz2 |
Merge topic 'mixed-lib-to-lib64'
af80da3 remove lib64 Unix paths if the respective lib path is also given
733726e find_library: Fix mixed lib->lib64 (non-)conversion cases (#13419)
54add62 find_library: Simplify lib->lib<arch> expansion
6ca2f82 find_library: Refactor lib->lib64 conversion
1fe4b82 find_library: Add test covering lib->lib64 cases
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/CMakeLists.txt | 61 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/64/libtest2.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/A/libtest1.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/libtest1.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/libtest2.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib/libtest3.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib64/A/libtest1.a | 0 | ||||
-rw-r--r-- | Tests/CMakeOnly/find_library/lib64/libtest1.a | 0 |
13 files changed, 63 insertions, 0 deletions
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index a1551ca..6fe91c7 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -23,6 +23,8 @@ add_CMakeOnly_test(AllFindModules) add_CMakeOnly_test(TargetScope) +add_CMakeOnly_test(find_library) + add_test(CMakeOnly.ProjectInclude ${CMAKE_CMAKE_COMMAND} -DTEST=ProjectInclude -DCMAKE_ARGS=-DCMAKE_PROJECT_ProjectInclude_INCLUDE=${CMAKE_CURRENT_SOURCE_DIR}/ProjectInclude/include.cmake diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt new file mode 100644 index 0000000..08f9331 --- /dev/null +++ b/Tests/CMakeOnly/find_library/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 2.8) +project(FindLibraryTest NONE) + +set(CMAKE_FIND_DEBUG_MODE 1) + +macro(test_find_library expected) + get_filename_component(dir ${expected} PATH) + get_filename_component(name ${expected} NAME) + string(REGEX REPLACE "lib/?64" "lib" dir "${dir}") + unset(LIB CACHE) + find_library(LIB + NAMES ${name} + PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir} + NO_DEFAULT_PATH + ) + if(LIB) + # Convert to relative path for comparison to expected location. + file(RELATIVE_PATH REL_LIB "${CMAKE_CURRENT_SOURCE_DIR}" "${LIB}") + + # Debugging output. + if(CMAKE_FIND_DEBUG_MODE) + message(STATUS "Library ${expected} searched as ${dir}, found as [${REL_LIB}].") + endif() + + # Check and report failure. + if(NOT "${REL_LIB}" STREQUAL "${expected}") + message(SEND_ERROR "Library ${l} should have been [${expected}] but was [${REL_LIB}]") + endif() + else() + message(SEND_ERROR "Library ${expected} searched as ${dir}, NOT FOUND!") + endif() +endmacro() + +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) + +set(CMAKE_SIZEOF_VOID_P 4) +foreach(lib + lib/A/lib/libtest1.a + lib/A/libtest1.a + lib/libtest1.a + lib/libtest2.a + lib/libtest3.a + lib/libtest3.a + ) + test_find_library(${lib}) +endforeach() + +set(CMAKE_SIZEOF_VOID_P 8) +foreach(lib64 + lib/64/libtest2.a + lib/A/lib64/libtest3.a + lib/libtest3.a + lib64/A/lib/libtest2.a + lib64/A/lib64/libtest1.a + lib64/A/libtest1.a + lib64/libtest1.a + ) + test_find_library(${lib64}) +endforeach() diff --git a/Tests/CMakeOnly/find_library/lib/64/libtest2.a b/Tests/CMakeOnly/find_library/lib/64/libtest2.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/64/libtest2.a diff --git a/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/A/lib/libtest1.a diff --git a/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a b/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/A/lib64/libtest3.a diff --git a/Tests/CMakeOnly/find_library/lib/A/libtest1.a b/Tests/CMakeOnly/find_library/lib/A/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/A/libtest1.a diff --git a/Tests/CMakeOnly/find_library/lib/libtest1.a b/Tests/CMakeOnly/find_library/lib/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/libtest1.a diff --git a/Tests/CMakeOnly/find_library/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib/libtest2.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/libtest2.a diff --git a/Tests/CMakeOnly/find_library/lib/libtest3.a b/Tests/CMakeOnly/find_library/lib/libtest3.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib/libtest3.a diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a b/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib64/A/lib/libtest2.a diff --git a/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib64/A/lib64/libtest1.a diff --git a/Tests/CMakeOnly/find_library/lib64/A/libtest1.a b/Tests/CMakeOnly/find_library/lib64/A/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib64/A/libtest1.a diff --git a/Tests/CMakeOnly/find_library/lib64/libtest1.a b/Tests/CMakeOnly/find_library/lib64/libtest1.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/CMakeOnly/find_library/lib64/libtest1.a |