Better error message when dependencies are not found
Recently-ish I had to build poppler (!876 (merged)). I wrongly concluded that I was missing NSS3 and gave up at first. Thanks to !876 (comment 973774) I gave it a second go. This MR is intended as "if this were merged two weeks ago, I wouldn't have been confused".
No idea why GitLab decided to use the commit message of the first commit to pre-fill this form. But okay. I also added the second commit message below.
Feel free to bike-shed the exact messages to use. Or even the way to generate the message (SEND_ERROR
plus later FATAL_ERROR
). This is just the first version that came to my mind. And it only touches the error messages that I saw.
(Well, I also got an error about boost, but that one already mentioned -DENABLE_BOOST=OFF
and was quick to get past)
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 libjeg.
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.
CMake Error at CMakeLists.txt:151 (message):
Possible options are: -DENABLE_DCTDECODER=libjpeg,
-DENABLE_DCTDECODER=unmaintained, -DENABLE_DCTDECODER=none
-- 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 psychon@znc.in
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: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.
CMake Error at CMakeLists.txt:256 (message):
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 psychon@znc.in