CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit fcdff7bb19e2ac0fab6505f17e0c18c8faa86323 Author: Uli Schlachter <[email protected]> Date: Thu Jul 1 16:20:39 2021 +0200 Better error messages when libopenjpeg2 is not found When I run "cmake -DENABLE_DCTDECODER=none -DENABLE_BOOST=OFF" on my system, I get the following output: -- Found Iconv: /usr/lib/x86_64-linux-gnu/libc.so CMake Warning at CMakeLists.txt:252 (find_package): By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenJPEG", but CMake did not find one. Could not find a package configuration file provided by "OpenJPEG" with any of the following names: OpenJPEGConfig.cmake openjpeg-config.cmake Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set "OpenJPEG_DIR" to a directory containing one of the above files. If "OpenJPEG" provides a separate development package or SDK, be sure it has been installed. CMake Error at CMakeLists.txt:255 (message): Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all. -- Configuring incomplete, errors occurred! See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log". See also "/tmp/poppler/build/CMakeFiles/CMakeError.log". To figure out what exactly to do now, I have to read some CMakeLists.txt. This commit improves the situation by producing the following output instead: -- Found Iconv: /usr/lib/x86_64-linux-gnu/libc.so CMake Warning at CMakeLists.txt:254 (find_package): By not providing "FindOpenJPEG.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenJPEG", but CMake did not find one. Could not find a package configuration file provided by "OpenJPEG" with any of the following names: OpenJPEGConfig.cmake openjpeg-config.cmake Add the installation prefix of "OpenJPEG" to CMAKE_PREFIX_PATH or set "OpenJPEG_DIR" to a directory containing one of the above files. If "OpenJPEG" provides a separate development package or SDK, be sure it has been installed. -- Could NOT find openjpeg2. CMake Error at CMakeLists.txt:258 (message): Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all. Possible options are: -DENABLE_LIBOPENJPEG=openjpeg2, -DENABLE_LIBOPENJPEG=none, -DENABLE_LIBOPENJPEG=unmaintained, -- Configuring incomplete, errors occurred! See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log". See also "/tmp/poppler/build/CMakeFiles/CMakeError.log". Signed-off-by: Uli Schlachter <[email protected]> diff --git a/CMakeLists.txt b/CMakeLists.txt index a1d7d11c..b060ff20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,7 +256,11 @@ if(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2") find_package(OpenJPEG) set(WITH_OPENJPEG ${OpenJPEG_FOUND}) if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION VERSION_LESS 2) - message(FATAL_ERROR "Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all.") + message(STATUS "Could NOT find openjpeg2.") + message(FATAL_ERROR "Install libopenjpeg2 before trying to build poppler. You \ +can also decide to use the internal unmaintained JPX decoder or none at all.\n\ +Possible options are: -DENABLE_LIBOPENJPEG=openjpeg2, -DENABLE_LIBOPENJPEG=none, \ +-DENABLE_LIBOPENJPEG=unmaintained,") endif() set(HAVE_JPX_DECODER ON) elseif(ENABLE_LIBOPENJPEG STREQUAL "unmaintained") commit 27ea06e3443ff0cc2250b26e5f3f170a6f531568 Author: Uli Schlachter <[email protected]> Date: Thu Jul 1 16:20:33 2021 +0200 Better error message when libjpeg is not found When I run cmake on my system, I get the following output: -- Checking for module 'nss>=3.19' -- Package 'nss', required by 'virtual:world', not found -- Could NOT find NSS3 (missing: NSS3_LIBRARIES NSS3_CFLAGS) CMake Error at CMakeLists.txt:149 (message): Install libjpeg before trying to build poppler. You can also decide to use the internal unmaintained DCT decoder or none at all. -- Configuring incomplete, errors occurred! See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log". See also "/tmp/poppler/build/CMakeFiles/CMakeError.log". Being (badly) trained in CMake errors, I see "Could NOT find NSS3" and conclude that this is the problem. I do not even read the actual error message. This commit improves the situation by producing the following output instead: -- Checking for module 'nss>=3.19' -- Package 'nss', required by 'virtual:world', not found -- Could NOT find NSS3 (missing: NSS3_LIBRARIES NSS3_CFLAGS) -- Could NOT find libjpeg. CMake Error at CMakeLists.txt:150 (message): Install libjpeg before trying to build poppler. You can also decide to use the internal unmaintained DCT decoder or none at all. Possible options are: -DENABLE_DCTDECODER=libjpeg, -DENABLE_DCTDECODER=none, -DENABLE_DCTDECODER=unmaintained -- Configuring incomplete, errors occurred! See also "/tmp/poppler/build/CMakeFiles/CMakeOutput.log". See also "/tmp/poppler/build/CMakeFiles/CMakeError.log". This also explicitly lists the possible values for the parameter that I figured out by reading the code around CMakeLists.txt:151. Signed-off-by: Uli Schlachter <[email protected]> diff --git a/CMakeLists.txt b/CMakeLists.txt index d1d3653a..a1d7d11c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,11 @@ if(ENABLE_DCTDECODER STREQUAL "libjpeg") if(JPEG_FOUND) set(ENABLE_LIBJPEG ${JPEG_FOUND}) else() - message(FATAL_ERROR "Install libjpeg before trying to build poppler. You can also decide to use the internal unmaintained DCT decoder or none at all.") + message(STATUS "Could NOT find libjpeg.") + message(FATAL_ERROR "Install libjpeg before trying to build poppler. You can \ +also decide to use the internal unmaintained DCT decoder or none at all.\n\ +Possible options are: -DENABLE_DCTDECODER=libjpeg, -DENABLE_DCTDECODER=none, \ +-DENABLE_DCTDECODER=unmaintained") endif() set(HAVE_DCT_DECODER ON) elseif(ENABLE_DCTDECODER STREQUAL "unmaintained") _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
