From e35170fd2529369ba65198ec44cd1a9f72976a5f Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Mon, 1 Jun 2026 10:39:47 +0300 Subject: [PATCH 1/2] Add option to allow use of system CRCpp Enable easier packaging on GNU/Linux distributions where bundling is discouraged. --- CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9241287..82cf9e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,20 @@ option( E57_BUILD_SHARED "Compile E57Format as a shared library" OFF ) +option( SYSTEM_CRCpp + "Use system crcpp rather than bundled version" + OFF +) +if( SYSTEM_CRCpp ) + find_path(crcpp_INCLUDE_PATH crc.h + ${CMAKE_INCLUDE_PATH} + $ENV{include}) + # Use bundled crcpp if not found + if ( NOT crcpp_INCLUDE_PATH ) + set( SYSTEM_CRCpp OFF ) + endif() +endif() if( BUILD_SHARED_LIBS ) set( E57_BUILD_SHARED ON ) endif() @@ -136,7 +149,9 @@ include( E57ExportHeader ) include( GitUpdate ) # Main sources and includes -add_subdirectory( extern/CRCpp ) +if ( NOT SYSTEM_CRCpp ) + add_subdirectory( extern/CRCpp ) +endif() add_subdirectory( include ) add_subdirectory( src ) From 79bd3e8a8597f3013ee93fe5b9a98c53ac8786b8 Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Mon, 1 Jun 2026 11:53:18 +0300 Subject: [PATCH 2/2] Stop build if system CRCpp is not found Use variable name consistent with the other CMake variables. Co-authored-by: Elaine Gibson <86775241+ypsvlq@users.noreply.github.com> --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82cf9e4..48aca71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,18 +83,17 @@ option( E57_BUILD_SHARED "Compile E57Format as a shared library" OFF ) -option( SYSTEM_CRCpp +option( E57_USE_EXTERNAL_CRCPP "Use system crcpp rather than bundled version" OFF ) -if( SYSTEM_CRCpp ) - find_path(crcpp_INCLUDE_PATH crc.h +if( E57_USE_EXTERNAL_CRCPP ) + find_path(crcpp_INCLUDE_PATH CRC.h ${CMAKE_INCLUDE_PATH} $ENV{include}) - # Use bundled crcpp if not found if ( NOT crcpp_INCLUDE_PATH ) - set( SYSTEM_CRCpp OFF ) + message( FATAL_ERROR "[${PROJECT_NAME}] E57_USE_EXTERNAL_CRCPP was enabled but CRC.h was not found" ) endif() endif() if( BUILD_SHARED_LIBS ) @@ -149,7 +148,7 @@ include( E57ExportHeader ) include( GitUpdate ) # Main sources and includes -if ( NOT SYSTEM_CRCpp ) +if ( NOT E57_USE_EXTERNAL_CRCPP ) add_subdirectory( extern/CRCpp ) endif() add_subdirectory( include )