Source

gd-libgd / src / CMakeLists.txt

Full commit
pajoye fcbe3c5 








pajoye 2d2d87e 




pajoye fcbe3c5 

















































nlopess f6d9e2a 
pajoye fcbe3c5 































pajoye e4c6001 



pajoye fcbe3c5 



































pajoye 2d2d87e 

pajoye e4c6001 
pajoye 2d2d87e 


pajoye e4c6001 
pajoye 2d2d87e 


pajoye fcbe3c5 

pajoye e4c6001 
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3 FATAL_ERROR)
PROJECT(GD)

SET(CMAKE_MODULE_PATH "${GD_SOURCE_DIR}/cmake/modules")

if (BUILD_TEST)
	ENABLE_TESTING()
endif(BUILD_TEST)

if (WIN32)
	SET(BGDWIN32 1)
	ADD_DEFINITIONS(-DBGDWIN32)
endif (WIN32)

if (USE_EXT_GD)
	message("Using GD at: ${USE_EXT_GD}")
	INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
	FIND_PACKAGE(GD)
	if (GD_FOUND)
		INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
		LINK_DIRECTORIES(BEFORE ${GD_LIBRARIES})
		SET(GD_LIB ${GD_LIBRARIES})
		SET(GD_LIBS_DIR ${GD_LIBRARY})

		message("GD libs #: ${GD_LIBRARIES}")
		message("GD lib #: ${GD_LIBRARY}")
		message("GD include: ${GD_INCLUDE_DIR}")
	else (GD_FOUND)
		message("No gd found")
	endif (GD_FOUND)
else (USE_EXT_GD)
	SET(GD_VERSION_MAJOR "2")
	SET(GD_VERSION_MINOR "0x0")
	SET(GD_VERSION_PATCH "34")
	SET(GD_VERSION "${GD_VERSION_MAJOR}.${GD_VERSION_MINOR}.${GD_VERSION_PATCH}")
	SET(GD_VERSION_STRING "${GD_VERSION}")

	SET(GD_VERSION_INT "20234")

	SET(PACKAGE GD)
	SET(PACKAGE_NAME GD)

	SET(CMAKE_REQUIRED_INCLUDES "/usr/include" "/usr/local/include")

	message(STATUS "ft2build: ${CMAKE_REQUIRED_INCLUDES}")

	include(CheckIncludeFiles)
	include(CheckIncludeFile)


	include(AC_HEADER_STDC)
	include(CheckPrototypeExists)

	FIND_PACKAGE(PNG REQUIRED)
	FIND_PACKAGE(ZLIB)
	FIND_PACKAGE(JPEG)
	FIND_PACKAGE(PTHREAD)
	FIND_PACKAGE(Freetype)
	FIND_PACKAGE(XPM)
	FIND_PACKAGE(Fontconfig)

	if (FREETYPE_FOUND)
		INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR})
		SET(HAVE_LIBFREETYPE 1)
		SET(HAVE_FT2BUILD_H 1)
	ENDIF(FREETYPE_FOUND)

	IF(ZLIB_FOUND)
		INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
		SET(HAVE_LIBZ 1)
		SET(HAVE_LIBPNG_PNG_H 1)
	ENDIF(ZLIB_FOUND)

	IF(PNG_FOUND)
		INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
		SET(HAVE_LIBPNG 1)
	ENDIF(PNG_FOUND)

	IF(XPM_FOUND)
		INCLUDE_DIRECTORIES(${XPM_INCLUDE_DIR})
		SET(HAVE_LIBXPM 1)
	ENDIF(XPM_FOUND)

	IF(JPEG_FOUND)
		INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
		SET(HAVE_LIBJPEG 1)
	ENDIF(JPEG_FOUND)

	IF(FONTCONFIG_FOUND)
		INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
		SET(HAVE_LIBFONTCONFIG 1)
	ENDIF(FONTCONFIG_FOUND)

	SET(HAVE_CONFIG_H 1)

	ADD_DEFINITIONS(-DHAVE_CONFIG_H)

	INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/  ${GD_SOURCE_DIR})
	
	CONFIGURE_FILE(${GD_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h ESCAPE_QUOTES)

	SET (LIBGD_SRC_FILES
		gd.c
		gdfx.c
		gd_security.c
		gd_gd.c
		gd_gd2.c
		gd_io.c
		gd_io_dp.c
		gd_gif_in.c
		gd_gif_out.c
		gd_io_file.c
		gd_io_ss.c
		gd_jpeg.c
		gd_png.c
		gd_ss.c
		gd_topal.c
		gd_wbmp.c
		gdcache.c
		gdfontg.c
		gdfontl.c
		gdfontmb.c
		gdfonts.c
		gdfontt.c
		gdft.c
		gdhelpers.c
		gdhelpers.h
		gdkanji.c
		gdtables.c
		gdxpm.c
		jisx0208.h
		wbmp.c
		wbmp.h
	)

	set(BUILD_SHARED_LIBS On)

	if (WIN32)
		SET(GD_LIB bgd)
		ADD_DEFINITIONS(/nodefaultlib:library)
	else(WIN32)
		SET(GD_LIB gd)
	endif(WIN32)

	add_library(${GD_LIB} ${LIBGD_SRC_FILES})
	target_link_libraries(${GD_LIB} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES})

endif (USE_EXT_GD)

add_subdirectory(tests)