]> source.dussan.org Git - tigervnc.git/commitdiff
Actually link and run the libjpeg-turbo test program to ensure that JPEG_LIBRARY...
authorDRC <dcommander@users.sourceforge.net>
Thu, 28 Jul 2011 08:06:39 +0000 (08:06 +0000)
committerDRC <dcommander@users.sourceforge.net>
Thu, 28 Jul 2011 08:06:39 +0000 (08:06 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4602 3789f03b-4d11-0410-bbf8-ca57d06f2519

CMakeLists.txt

index ba72c99236bdf7905ca5dc8fa4f8bcd3de1d4bb3..e2d33f6b2e239287404e41c3858885453d17f273 100644 (file)
@@ -13,6 +13,7 @@ include(CheckLibraryExists)
 include(CheckTypeSize)
 include(CheckCSourceCompiles)
 include(CheckCXXSourceCompiles)
+include(CheckCSourceRuns)
 
 include(CMakeMacroLibtoolFile)
 
@@ -176,11 +177,28 @@ find_package(JPEG REQUIRED)
 # Warn if it doesn't seem to be the accelerated libjpeg that's found
 set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
+if(MSVC)
+  set(CMAKE_REQUIRED_DEFINITIONS -MT)
+endif()
 
-check_c_source_compiles("#include <stdio.h>\n#include <jpeglib.h>\nint main(int c, char** v) { return JCS_EXT_RGBX; }" FOUND_LIBJPEG_TURBO)
+check_c_source_runs("\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
+  }" FOUND_LIBJPEG_TURBO)
 
 set(CMAKE_REQUIRED_LIBRARIES)
 set(CMAKE_REQUIRED_FLAGS)
+set(CMAKE_REQUIRED_DEFINITIONS)
 
 if(NOT FOUND_LIBJPEG_TURBO)
   message(STATUS "WARNING: You are not using libjpeg-turbo. Performance will suffer.")