Skip to content

Commit ccb17dc

Browse files
authored
Merge pull request #6150 from blowekamp/fix/tiff-field-readcount-detection
BUG: Use check_symbol_exists for TIFFFieldReadCount detection
2 parents f7ff6ad + 811e72e commit ccb17dc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Modules/ThirdParty/TIFF/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ if(ITK_USE_SYSTEM_TIFF)
1717
# Check availability of different methods to access TIFF's field
1818
# data structure.
1919
include(CheckTypeSize)
20+
include(CheckSymbolExists)
2021
set(CMAKE_REQUIRED_LIBRARIES TIFF::TIFF)
2122
set(CMAKE_EXTRA_INCLUDE_FILES "tiffio.h")
22-
check_type_size(TIFFFieldReadCount ITK_TIFF_HAS_TIFFFieldReadCount)
23+
# TIFFFieldReadCount is a function, not a type. Using
24+
# check_type_size (sizeof) on a function is non-standard and fails
25+
# on MSVC, causing the wrong code path and crashes. Use
26+
# check_symbol_exists instead.
27+
check_symbol_exists(TIFFFieldReadCount "tiffio.h" ITK_TIFF_HAS_TIFFFieldReadCount)
2328
check_type_size(TIFFField* ITK_TIFF_HAS_TIFFField)
2429
else()
2530
set(ITKTIFF_INCLUDE_DIRS

0 commit comments

Comments
 (0)