summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeOnly
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeOnly')
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt5
-rw-r--r--Tests/CMakeOnly/find_library/A/libtestA.a0
-rw-r--r--Tests/CMakeOnly/find_library/B/libtestB.a0
-rw-r--r--Tests/CMakeOnly/find_library/CMakeLists.txt49
4 files changed, 34 insertions, 20 deletions
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 212c758..739593c 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -70,8 +70,9 @@ endmacro()
# If any of these modules reported that it was found a version number should have been
# reported.
-foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG HSPELL
- JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG PostgreSQL TIFF ZLIB)
+foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG
+ HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG
+ PostgreSQL TIFF ZLIB)
check_version_string(${VTEST} ${VTEST}_VERSION_STRING)
endforeach()
diff --git a/Tests/CMakeOnly/find_library/A/libtestA.a b/Tests/CMakeOnly/find_library/A/libtestA.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/A/libtestA.a
diff --git a/Tests/CMakeOnly/find_library/B/libtestB.a b/Tests/CMakeOnly/find_library/B/libtestB.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CMakeOnly/find_library/B/libtestB.a
diff --git a/Tests/CMakeOnly/find_library/CMakeLists.txt b/Tests/CMakeOnly/find_library/CMakeLists.txt
index 08f9331..2d4ecaf 100644
--- a/Tests/CMakeOnly/find_library/CMakeLists.txt
+++ b/Tests/CMakeOnly/find_library/CMakeLists.txt
@@ -3,34 +3,34 @@ 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}")
+macro(test_find_library desc expected)
unset(LIB CACHE)
- find_library(LIB
- NAMES ${name}
- PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
- NO_DEFAULT_PATH
- )
+ find_library(LIB ${ARGN} 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}]")
+ message(SEND_ERROR "Library ${expected} found as [${REL_LIB}]${desc}")
+ elseif(CMAKE_FIND_DEBUG_MODE)
+ message(STATUS "Library ${expected} found as [${REL_LIB}]${desc}")
endif()
else()
- message(SEND_ERROR "Library ${expected} searched as ${dir}, NOT FOUND!")
+ message(SEND_ERROR "Library ${expected} NOT FOUND${desc}")
endif()
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}")
+ test_find_library(", searched as ${dir}" "${expected}"
+ NAMES ${name}
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${dir}
+ )
+endmacro()
+
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
@@ -44,7 +44,7 @@ foreach(lib
lib/libtest3.a
lib/libtest3.a
)
- test_find_library(${lib})
+ test_find_library_subst(${lib})
endforeach()
set(CMAKE_SIZEOF_VOID_P 8)
@@ -57,5 +57,18 @@ foreach(lib64
lib64/A/libtest1.a
lib64/libtest1.a
)
- test_find_library(${lib64})
+ test_find_library_subst(${lib64})
endforeach()
+
+test_find_library("" A/libtestA.a
+ NAMES testA testB
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+test_find_library("" B/libtestB.a
+ NAMES testB testA
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+test_find_library("" A/libtestA.a
+ NAMES testB testA NAMES_PER_DIR
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )