cmake_minimum_required (VERSION 3.12.0)
project (lib_checkit_tiff VERSION 1.1 LANGUAGES C CXX)
set(icc_objects_dir ${CMAKE_CURRENT_BINARY_DIR}/IccProfLib/ )
file(MAKE_DIRECTORY ${icc_objects_dir})
include_directories("${PROJECT_SOURCE_DIR}/include")
include_directories("${PROJECT_SOURCE_DIR}/validate_icc")
file( GLOB checkit_tiff_SOURCES
        "${PROJECT_SOURCE_DIR}/tagrules/*.c"
        "${PROJECT_SOURCE_DIR}/ifdrules/*.c"
        "${PROJECT_SOURCE_DIR}/messages/*.c"
        "${PROJECT_SOURCE_DIR}/helper/*.c"
        "${PROJECT_SOURCE_DIR}/helper/renderer/*.c"
        "${PROJECT_SOURCE_DIR}/validate_icc/*.c"
        "${PROJECT_SOURCE_DIR}/risk_analyzer/*.c"
        )

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

if (RefIccMAX_FOUND)
    set(checkit_tiff_SOURCES "${checkit_tiff_SOURCES};${PROJECT_SOURCE_DIR}/validate_icc/validate_icc_with_IccProfLib.cpp")
endif()

add_library(libcheckit_tiff STATIC
        ${checkit_tiff_SOURCES}
        )
target_include_directories(libcheckit_tiff PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(libcheckit_tiff PUBLIC __STDC_LIMIT_MACROS __STDC_FORMAT_MACROS)
if (STATIC)
    message(STATUS "linking libcheckit_tiff statically with" ${WITH_OPTIONAL_REFICCMAX})
    target_link_libraries(libcheckit_tiff ${WITH_OPTIONAL_REFICCMAX})
else()
    message(STATUS "linking libcheckit_tiff dynamically with" ${WITH_OPTIONAL_REFICCMAX})
    target_link_libraries(libcheckit_tiff ${WITH_OPTIONAL_REFICCMAX})
#    target_link_libraries(libcheckit_tiff PRIVATE ${REFICMAX_LIBRARIES})
endif()
