2016-12-14 22:58:00 +08:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2019-10-08 01:35:13 +08:00
|
|
|
project(little-cms)
|
2016-12-14 22:58:00 +08:00
|
|
|
|
2021-09-24 02:00:41 +08:00
|
|
|
file(GLOB SRCS src/*.c)
|
2017-11-13 09:21:27 +08:00
|
|
|
|
2021-09-24 02:00:41 +08:00
|
|
|
add_library(lcms2 ${SRCS} src/lcms2.def)
|
2017-08-20 04:29:24 +08:00
|
|
|
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2021-09-08 06:19:07 +08:00
|
|
|
target_compile_options(lcms2 PRIVATE -DCMS_DLL_BUILD)
|
|
|
|
target_compile_options(lcms2 PUBLIC -DCMS_DLL)
|
2017-08-20 04:29:24 +08:00
|
|
|
endif()
|
2021-09-08 06:19:07 +08:00
|
|
|
target_compile_options(lcms2 PRIVATE -DUNICODE -D_UNICODE)
|
2017-08-20 04:29:24 +08:00
|
|
|
|
2022-01-13 03:32:27 +08:00
|
|
|
target_include_directories(lcms2 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
2021-09-08 06:19:07 +08:00
|
|
|
set_target_properties(lcms2 PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/include/lcms2.h;${CMAKE_CURRENT_LIST_DIR}/include/lcms2_plugin.h")
|
2016-12-15 16:12:00 +08:00
|
|
|
|
2021-09-08 06:19:07 +08:00
|
|
|
# Generate pkg-config file
|
|
|
|
SET(PACKAGE "lcms2")
|
|
|
|
# Read VERSION from file configure
|
|
|
|
file(READ "${CMAKE_CURRENT_LIST_DIR}/configure" lcms2_configure)
|
|
|
|
string(REGEX MATCH "PACKAGE_VERSION='(([0-9]+)\\.([0-9]+))'" _ ${lcms2_configure})
|
|
|
|
set(VERSION "${CMAKE_MATCH_1}")
|
|
|
|
SET(prefix "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
SET(exec_prefix "\${prefix}")
|
|
|
|
SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
SET(includedir "\${prefix}/include")
|
|
|
|
CONFIGURE_FILE(lcms2.pc.in "${PROJECT_BINARY_DIR}/lcms2.pc" @ONLY)
|
|
|
|
|
|
|
|
install(TARGETS lcms2
|
2021-09-24 02:00:41 +08:00
|
|
|
EXPORT lcms2Config
|
2019-10-08 01:35:13 +08:00
|
|
|
RUNTIME DESTINATION "bin"
|
|
|
|
LIBRARY DESTINATION "lib"
|
|
|
|
ARCHIVE DESTINATION "lib"
|
|
|
|
PUBLIC_HEADER DESTINATION "include"
|
2016-12-14 22:58:00 +08:00
|
|
|
)
|
|
|
|
|
2021-09-08 06:19:07 +08:00
|
|
|
INSTALL(FILES ${PROJECT_BINARY_DIR}/lcms2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
|
2021-09-24 02:00:41 +08:00
|
|
|
install(EXPORT lcms2Config
|
|
|
|
DESTINATION "share/lcms2"
|
2021-09-08 06:19:07 +08:00
|
|
|
NAMESPACE lcms2::
|
2019-10-08 01:35:13 +08:00
|
|
|
)
|
2016-12-14 22:58:00 +08:00
|
|
|
|
2021-09-24 02:00:41 +08:00
|
|
|
# Backwards compatibility for previous vcpkg users
|
|
|
|
add_library(lcms INTERFACE)
|
|
|
|
target_link_libraries(lcms INTERFACE lcms2)
|
|
|
|
|
|
|
|
|
|
|
|
install(TARGETS lcms EXPORT lcms-targets)
|
|
|
|
install(EXPORT lcms-targets
|
2019-10-08 01:35:13 +08:00
|
|
|
DESTINATION "share/lcms"
|
2021-09-24 02:00:41 +08:00
|
|
|
NAMESPACE lcms::
|
2016-12-14 22:58:00 +08:00
|
|
|
)
|