@@ -450,32 +450,45 @@ if(BZIP2_FOUND)
450450 option (PCRE2_SUPPORT_LIBBZ2 "Enable support for linking pcre2grep with libbz2." ON )
451451endif ()
452452if (PCRE2_SUPPORT_LIBBZ2)
453- include_directories (${BZIP2_INCLUDE_DIR} )
453+ if (BZIP2_FOUND)
454+ include_directories (${BZIP2_INCLUDE_DIR} )
455+ else ()
456+ message (
457+ FATAL_ERROR
458+ " libbz2 not found. Set BZIP2_INCLUDE_DIR to a compatible header\n "
459+ " or set BZip2_ROOT to a full bzip2 installed tree, as needed."
460+ )
461+ endif ()
454462endif ()
455463
456464# zlib
457465if (ZLIB_FOUND)
458466 option (PCRE2_SUPPORT_LIBZ "Enable support for linking pcre2grep with libz." ON )
459467endif ()
460468if (PCRE2_SUPPORT_LIBZ)
461- include_directories (${ZLIB_INCLUDE_DIR} )
469+ if (ZLIB_FOUND)
470+ include_directories (${ZLIB_INCLUDE_DIR} )
471+ else ()
472+ message (
473+ FATAL_ERROR
474+ " zlib not found. Set ZLIB_INCLUDE_DIR to a compatible header\n "
475+ " or set ZLIB_ROOT to a full zlib installed tree, as needed."
476+ )
477+ endif ()
462478endif ()
463479
464480# editline lib
465481if (EDITLINE_FOUND)
466482 option (PCRE2_SUPPORT_LIBEDIT "Enable support for linking pcre2test with libedit." OFF )
467483endif ()
468- if (EDITLINE_FOUND )
469- if (PCRE2_SUPPORT_LIBEDIT )
484+ if (PCRE2_SUPPORT_LIBEDIT )
485+ if (EDITLINE_FOUND )
470486 include_directories (${EDITLINE_INCLUDE_DIR} )
471- endif ()
472- else ()
473- if (PCRE2_SUPPORT_LIBEDIT)
487+ else ()
474488 message (
475489 FATAL_ERROR
476- " libedit not found, set EDITLINE_INCLUDE_DIR to a compatible header\n "
477- " or set Editline_ROOT to a full libedit installed tree, as needed\n "
478- " Might need to enable policy CMP0074 in CMakeLists.txt"
490+ " libedit not found. Set EDITLINE_INCLUDE_DIR to a compatible header\n "
491+ " or set Editline_ROOT to a full libedit installed tree, as needed."
479492 )
480493 endif ()
481494endif ()
@@ -485,7 +498,15 @@ if(READLINE_FOUND)
485498 option (PCRE2_SUPPORT_LIBREADLINE "Enable support for linking pcre2test with libreadline." ON )
486499endif ()
487500if (PCRE2_SUPPORT_LIBREADLINE)
488- include_directories (${READLINE_INCLUDE_DIR} )
501+ if (READLINE_FOUND)
502+ include_directories (${READLINE_INCLUDE_DIR} )
503+ else ()
504+ message (
505+ FATAL_ERROR
506+ " libreadline not found. Set READLINE_INCLUDE_DIR to a compatible header\n "
507+ " or set Readline_ROOT to a full libreadline installed tree, as needed."
508+ )
509+ endif ()
489510endif ()
490511
491512# Prepare build configuration
@@ -1493,7 +1514,12 @@ if(PCRE2_SHOW_REPORT)
14931514 endforeach ()
14941515 else ()
14951516 string (TOUPPER "${CMAKE_BUILD_TYPE} " buildtype)
1496- message (STATUS " C compiler flags .................. : ${CMAKE_C_FLAGS}${CFSP} ${CMAKE_C_FLAGS_${buildtype} }" )
1517+ if (buildtype STREQUAL "" )
1518+ set (CFBLD "" )
1519+ else ()
1520+ set (CFBLD "${CMAKE_C_FLAGS_${buildtype} }" )
1521+ endif ()
1522+ message (STATUS " C compiler flags .................. : ${CMAKE_C_FLAGS}${CFSP}${CFBLD} " )
14971523 endif ()
14981524
14991525 message (STATUS "" )
0 commit comments