From cf8f189be20b600b59e273216c568c07a0bd2501 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 13 May 2022 19:30:04 +0100 Subject: [PATCH] Allow usage of lcms2 when compiling with Clang Otherwise the build fails for me with the following error: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister] Upstream does not appear willing to fix this issue, so we have to add a define to avoid usage of this useless keyword. See https://github.com/mm2/Little-CMS/issues/190 and https://github.com/mm2/Little-CMS/issues/243. --- cmake/modules/Findlcms2.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/Findlcms2.cmake b/cmake/modules/Findlcms2.cmake index f2707eb2cd..c488a0d9a2 100644 --- a/cmake/modules/Findlcms2.cmake +++ b/cmake/modules/Findlcms2.cmake @@ -61,6 +61,9 @@ if (lcms2_FOUND AND NOT TARGET lcms2::lcms2) set_target_properties(lcms2::lcms2 PROPERTIES IMPORTED_LOCATION "${lcms2_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${lcms2_DEFINITIONS}" + # Don't use the register keyword to allow compiling in C++17 mode. + # See https://github.com/mm2/Little-CMS/issues/243 + INTERFACE_COMPILE_DEFINITIONS "CMS_NO_REGISTER_KEYWORD=1" INTERFACE_INCLUDE_DIRECTORIES "${lcms2_INCLUDE_DIR}" ) endif()