]> git.cworth.org Git - apitrace/commitdiff
Always use bundled zlib and libpng sources.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 21 Jun 2011 22:58:22 +0000 (23:58 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Tue, 21 Jun 2011 23:55:54 +0000 (00:55 +0100)
Dynamically linking against them can cause conflicts when tracing
applications that dynamically link against different versions.

CMakeLists.txt
libpng/CMakeLists.txt
zlib/CMakeLists.txt

index cd320440e8092d1244817a1476d436e63c9df9a9..f388991973368cc101f53fafb78da64bbecd333a 100755 (executable)
@@ -15,13 +15,6 @@ find_package (OpenGL REQUIRED)
 find_package (Qt4 4.7 COMPONENTS QtCore QtGui QtWebKit)
 find_package (QJSON)
 
-if (NOT WIN32)
-    # Always use the bundled zlib and libpng sources on Windows to make it easy
-    # to deploy the wrappers DLLs
-    find_package (ZLIB)
-    find_package (PNG)
-endif (NOT WIN32)
-
 if (NOT WIN32)
     find_package (X11 REQUIRED)
 
@@ -119,25 +112,24 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
 
 ##############################################################################
 # Bundled dependencies
+#
+# We always use the bundled zlib and libpng sources:
+# - on Windows to make it easy to deploy the wrappers DLLs
+# - on unices to prevent symbol collisions when tracing applications that link
+# against other versions of these libraries
 
-# Use bundled ZLIB if system one can't be found
-if (NOT ZLIB_FOUND)
-    set (ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
-    set (ZLIB_LIBRARIES zlib)
-    add_subdirectory (zlib EXCLUDE_FROM_ALL)
-endif (NOT ZLIB_FOUND)
+set (ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
+set (ZLIB_LIBRARIES z_bundled)
+add_subdirectory (zlib EXCLUDE_FROM_ALL)
 
 include_directories (${ZLIB_INCLUDE_DIRS})
 link_libraries (${ZLIB_LIBRARIES})
 
-# Use bundled LIBPNG if system one can't be found
-if (PNG_FOUND)
-else (PNG_FOUND)
-    set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libpng)
-    set (PNG_DEFINITIONS "")
-    set (PNG_LIBRARIES png)
-    add_subdirectory (libpng EXCLUDE_FROM_ALL)
-endif (PNG_FOUND)
+set (PNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libpng)
+set (PNG_DEFINITIONS "")
+set (PNG_LIBRARIES png_bundled)
+
+add_subdirectory (libpng EXCLUDE_FROM_ALL)
 include_directories (${PNG_INCLUDE_DIR})
 add_definitions (${PNG_DEFINITIONS})
 link_libraries (${PNG_LIBRARIES})
index def8c5b3662e75d95e99fc5e0aff0d3b506b4802..7775f915a9c1a0fd5f9d72f4d5e4db3214e4cda5 100644 (file)
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
-add_library (png STATIC
+add_library (png_bundled STATIC
     png.c
     pngerror.c
     pngget.c
@@ -18,6 +18,6 @@ add_library (png STATIC
     pngwutil.c
 )
 
-set_target_properties (png PROPERTIES
+set_target_properties (png_bundled PROPERTIES
     COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
 )
index 24a97a6e4fe7b97e9f0786fe4f751eb2648db5cb..42caa7bec31a0408d356588cf8a5f2ff49273b29 100644 (file)
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
-add_library (zlib STATIC
+add_library (z_bundled STATIC
     adler32.c
     compress.c
     crc32.c
@@ -15,6 +15,6 @@ add_library (zlib STATIC
     inffast.c
 )
 
-set_target_properties (zlib PROPERTIES
+set_target_properties (z_bundled PROPERTIES
     COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
 )