1# CMake build for libtiff
2#
3# Copyright © 2015 Open Microscopy Environment / University of Dundee
4# Written by Roger Leigh <rleigh@codelibre.net>
5#
6# Permission to use, copy, modify, distribute, and sell this software and
7# its documentation for any purpose is hereby granted without fee, provided
8# that (i) the above copyright notices and this permission notice appear in
9# all copies of the software and related documentation, and (ii) the names of
10# Sam Leffler and Silicon Graphics may not be used in any advertising or
11# publicity relating to the software without the specific, prior written
12# permission of Sam Leffler and Silicon Graphics.
13#
14# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17#
18# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
19# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23# OF THIS SOFTWARE.
24
25set(port_HEADERS libport.h)
26set(port_SOURCES dummy.c)
27set(port_optional_SOURCES
28  getopt.c
29  lfind.c
30  strcasecmp.c
31  strtoul.c
32  strtoull.c)
33
34set(port_USED_FILES ${port_SOURCES} ${port_HEADERS})
35
36if(NOT HAVE_GETOPT)
37  list(APPEND port_USED_FILES getopt.c)
38endif()
39if(NOT HAVE_LFIND)
40  list(APPEND port_USED_FILES lfind.c)
41endif()
42if(MSVC AND NOT HAVE_SNPRINTF)
43  list(APPEND port_USED_FILES snprintf.c)
44endif()
45if(NOT HAVE_STRCASECMP)
46  list(APPEND port_USED_FILES strcasecmp.c)
47endif()
48if(NOT HAVE_STRTOUL)
49  list(APPEND port_USED_FILES strtoul.c)
50endif()
51if(NOT HAVE_STRTOULL)
52  list(APPEND port_USED_FILES strtoull.c)
53endif()
54
55add_library(port STATIC ${port_USED_FILES})
56
57foreach(file ${port_USED_FILES})
58  list(APPEND tiff_port_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
59endforeach()
60set(tiff_port_SOURCES ${tiff_port_SOURCES} PARENT_SCOPE)
61