# Minimal CMake build for Little-CMS (lcms2).
#
# Upstream ships no CMakeLists.txt (only autotools + meson + hand-written Visual
# Studio projects), and its ./configure cannot run under MSVC on the Windows
# ARM64 runner (no Unix shell). extlib_lcms2.cmake injects this file as the
# source-tree CMakeLists.txt via the ExternalProject PATCH_COMMAND so lcms2 can
# be built with the active MSVC generator, like the other from-source externals.
cmake_minimum_required(VERSION 3.15)
project(lcms2 C)

# The library is exactly src/*.c; utilities/tests live outside src/.
file(GLOB LCMS2_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")

add_library(lcms2 STATIC ${LCMS2_SOURCES})
target_include_directories(lcms2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

# Leave CMS_DLL / CMS_DLL_BUILD undefined so CMSAPI resolves to plain symbols
# (no __declspec(dllimport/dllexport)) for static build and static consumption.

install(TARGETS lcms2 ARCHIVE DESTINATION lib)
install(FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/include/lcms2.h"
    "${CMAKE_CURRENT_SOURCE_DIR}/include/lcms2_plugin.h"
    DESTINATION include)
