summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2017-12-28 17:23:45 -0500
committerBen Boeckel <ben.boeckel@kitware.com>2018-01-15 11:27:34 -0500
commitfc3b73530009b0ac4e4ea13627a341a5d75bd045 (patch)
tree399ea3da3b5a97eb0e7529b67496968f06c4bda8 /CMakeLists.txt
parentf5b23ab1bf72ac2cdaae0b2c394daf035e95d934 (diff)
downloadlibtiff-git-fc3b73530009b0ac4e4ea13627a341a5d75bd045.tar.gz
cmake: use check_symbol_exists
This accounts for symbols being provided by macros.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 9 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2ed0566..ad6b4e49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,7 +93,7 @@ include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckIncludeFile)
include(CheckTypeSize)
-include(CheckFunctionExists)
+include(CheckSymbolExists)
enable_testing()
macro(current_date var)
@@ -383,22 +383,13 @@ endif()
# TIFF_SSIZE_T TIFF_SSIZE_FORMAT
# TIFF_PTRDIFF_T TIFF_PTRDIFF_FORMAT)
-check_function_exists(mmap HAVE_MMAP)
-check_function_exists(setmode HAVE_SETMODE)
-check_function_exists(strcasecmp HAVE_STRCASECMP)
-check_function_exists(strtol HAVE_STRTOUL)
-check_function_exists(getopt HAVE_GETOPT)
-check_function_exists(lfind HAVE_LFIND)
-
-# May be inlined, so check it compiles:
-check_c_source_compiles("
-#include <stdio.h>
-int main(void) {
- char buf[10];
- snprintf(buf, 10, \"Test %d\", 1);
- return 0;
-}"
- HAVE_SNPRINTF)
+check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
+check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
+check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
+check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
+check_symbol_exists(strtol "stdlib.h" HAVE_STRTOUL)
+check_symbol_exists(getopt "unistd.h" HAVE_GETOPT)
+check_symbol_exists(lfind "search.h" HAVE_LFIND)
if(NOT HAVE_SNPRINTF)
add_definitions(-DNEED_LIBPORT)
@@ -531,12 +522,9 @@ else()
set(JBIG_FOUND FALSE)
endif()
-set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR})
-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARY})
-check_function_exists(jbg_newlen HAVE_JBG_NEWLEN)
-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
+check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
# liblzma2