cmake_minimum_required(VERSION 3.0)

project(DevIL)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

file(GLOB DevIL_SRCS src/*.c)
file(GLOB DevIL_INC include/*.h ../include/config.h ../include/IL/devil_internal_exports.h ../include/IL/il.h)

include_directories( include ../include )

if(BUILD_SHARED_LIBS)
    add_library(IL SHARED ${DevIL_SRCS} ${DevIL_INC})
else(BUILD_SHARED_LIBS)
    add_library(IL ${DevIL_SRCS} ${DevIL_INC})
endif(BUILD_SHARED_LIBS)

find_package(JPEG)
find_package(PNG)
set(libs ${JPEG_LIBRARIES} ${PNG_LIBRARIES})
set(incs ${JPEG_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS})
include_directories(${incs})
target_link_libraries(IL ${libs})

# note: config.h is generated by conan outside

if(WIN32)
	# Linux uses libIL.so, libILU.so, and libILUT.so, but Windows uses
	#  DevIL.dll, ILU.dll, and ILUT.dll.
	set_target_properties(IL PROPERTIES OUTPUT_NAME "DevIL")
endif(WIN32)
