summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2018-09-26 20:48:25 +0200
committerChristian Beier <dontmind@freeshell.org>2018-09-26 20:48:25 +0200
commit77dce5b6af7d95afc486b7353217743f4371bb04 (patch)
tree3eabf4a2036d0a77e4c9fdb0af5aa2e9cbdcde01
parentd6c907ffbc36f4ad7663a44538b15e650a6ddf40 (diff)
downloadlibtdevnc-77dce5b6af7d95afc486b7353217743f4371bb04.tar.gz
libtdevnc-77dce5b6af7d95afc486b7353217743f4371bb04.zip
CMake: only do jpeg-turbo tests if a libjpeg was found
-rw-r--r--CMakeLists.txt68
1 files changed, 35 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0f1537..70907b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,39 +58,41 @@ endif(WITH_ZLIB)
if(WITH_JPEG)
find_package(JPEG)
- # Check whether the version of libjpeg we found was libjpeg-turbo and print a
- # warning if not.
- set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
- set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
-
- set(JPEG_TEST_SOURCE "\n
- #include <stdio.h>\n
- #include <jpeglib.h>\n
- int main(void) {\n
- struct jpeg_compress_struct cinfo;\n
- struct jpeg_error_mgr jerr;\n
- cinfo.err=jpeg_std_error(&jerr);\n
- jpeg_create_compress(&cinfo);\n
- cinfo.input_components = 3;\n
- jpeg_set_defaults(&cinfo);\n
- cinfo.in_color_space = JCS_EXT_RGB;\n
- jpeg_default_colorspace(&cinfo);\n
- return 0;\n
- }")
-
- if(CMAKE_CROSSCOMPILING)
- check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
- else()
- check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
- endif()
-
- set(CMAKE_REQUIRED_LIBRARIES)
- set(CMAKE_REQUIRED_FLAGS)
- set(CMAKE_REQUIRED_DEFINITIONS)
-
- if(NOT FOUND_LIBJPEG_TURBO)
- message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
- endif()
+ if(JPEG_FOUND)
+ # Check whether the version of libjpeg we found was libjpeg-turbo and print a
+ # warning if not.
+ set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
+ set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
+
+ set(JPEG_TEST_SOURCE "\n
+ #include <stdio.h>\n
+ #include <jpeglib.h>\n
+ int main(void) {\n
+ struct jpeg_compress_struct cinfo;\n
+ struct jpeg_error_mgr jerr;\n
+ cinfo.err=jpeg_std_error(&jerr);\n
+ jpeg_create_compress(&cinfo);\n
+ cinfo.input_components = 3;\n
+ jpeg_set_defaults(&cinfo);\n
+ cinfo.in_color_space = JCS_EXT_RGB;\n
+ jpeg_default_colorspace(&cinfo);\n
+ return 0;\n
+ }")
+
+ if(CMAKE_CROSSCOMPILING)
+ check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
+ else()
+ check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
+ endif()
+
+ set(CMAKE_REQUIRED_LIBRARIES)
+ set(CMAKE_REQUIRED_FLAGS)
+ set(CMAKE_REQUIRED_DEFINITIONS)
+
+ if(NOT FOUND_LIBJPEG_TURBO)
+ message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
+ endif()
+ endif(JPEG_FOUND)
endif(WITH_JPEG)