cmake: update build files to match autotools more
Clean up redundant header logic and focus on what we actually care about: whether specific headers exist. Update the program list to omit programs when required libs are not found.master
parent
2db153a93e
commit
b083ec17ad
|
@ -1,42 +1,14 @@
|
|||
message(STATUS "Checking whether system has ANSI C header files")
|
||||
include(CheckPrototypeExists)
|
||||
|
||||
include(CheckPrototypeExists)
|
||||
check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" StandardHeadersExist)
|
||||
if(StandardHeadersExist)
|
||||
check_prototype_exists(memchr string.h memchrExists)
|
||||
if(memchrExists)
|
||||
|
||||
check_prototype_exists(free stdlib.h freeExists)
|
||||
if(freeExists)
|
||||
message(STATUS "ANSI C header files - found")
|
||||
set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files")
|
||||
set(HAVE_STRINGS_H 1)
|
||||
set(HAVE_STRING_H 1)
|
||||
set(HAVE_FLOAT_H 1)
|
||||
set(HAVE_STDLIB_H 1)
|
||||
set(HAVE_STDDEF_H 1)
|
||||
set(HAVE_STDINT_H 1)
|
||||
set(HAVE_INTTYPES_H 1)
|
||||
set(HAVE_DLFCN_H 1)
|
||||
endif(freeExists)
|
||||
endif(memchrExists)
|
||||
endif(StandardHeadersExist)
|
||||
|
||||
if(NOT STDC_HEADERS)
|
||||
message(STATUS "ANSI C header files - not found")
|
||||
set(STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files")
|
||||
endif(NOT STDC_HEADERS)
|
||||
|
||||
|
||||
check_include_files(dirent.h HAVE_DIRENT_H)
|
||||
check_include_files(errno.h HAVE_ERRNO_H)
|
||||
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_files(stddef.h HAVE_STDDEF_H)
|
||||
check_include_files(stdint.h HAVE_STDINT_H)
|
||||
check_include_files(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_files(string.h HAVE_STRING_H)
|
||||
check_include_files(strings.h HAVE_STRINGS_H)
|
||||
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
include(CheckDIRSymbolExists)
|
||||
check_dirsymbol_exists("sys/stat.h;sys/types.h;dirent.h" HAVE_DIRENT_H)
|
||||
if (HAVE_DIRENT_H)
|
||||
set(HAVE_SYS_STAT_H 1)
|
||||
set(HAVE_SYS_TYPES_H 1)
|
||||
endif (HAVE_DIRENT_H)
|
||||
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
|
||||
|
||||
check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" StandardHeadersExist)
|
||||
set(HAVE_LIBM 1)
|
||||
|
|
|
@ -103,7 +103,23 @@ endif()
|
|||
|
||||
target_link_libraries(${GD_LIB_STATIC} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${ICONV_LIBRARIES} ${LIQ_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY} ${WEBP_LIBRARIES} )
|
||||
|
||||
set(GD_PROGRAMS annotate gdparttopng gdtopng gd2copypal gd2topng pngtogd pngtogd2 webpng gd2togif gdcmpgif giftogd2)
|
||||
set(GD_PROGRAMS gdcmpgif)
|
||||
|
||||
if (PNG_FOUND)
|
||||
set(GD_PROGRAMS ${GD_PROGRAMS} gdtopng pngtogd webpng)
|
||||
if (ZLIB_FOUND)
|
||||
set(GD_PROGRAMS ${GD_PROGRAMS} gdparttopng gd2topng pngtogd2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (FREETYPE_FOUND)
|
||||
set(GD_PROGRAMS ${GD_PROGRAMS} annotate)
|
||||
endif()
|
||||
|
||||
if (ZLIB_FOUND)
|
||||
set(GD_PROGRAMS ${GD_PROGRAMS} gd2copypal gd2togif giftogd2)
|
||||
endif()
|
||||
|
||||
foreach(program ${GD_PROGRAMS})
|
||||
add_executable(${program} ${program}.c)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
|
|
Loading…
Reference in New Issue