]> git.cworth.org Git - apitrace/blobdiff - CMakeLists.txt
Build retrace sources only once.
[apitrace] / CMakeLists.txt
index d42aa1e05900e5701372cefd68bbd1b2b50918da..ed0905510333f44c722cf535f57b095351500679 100755 (executable)
@@ -60,10 +60,6 @@ else ()
         include_directories (${X11_INCLUDE_DIR})
         add_definitions (-DHAVE_X11)
     endif ()
-
-    if (ENABLE_EGL)
-        add_definitions (-DHAVE_EGL)
-    endif ()
 endif ()
 
 
@@ -510,12 +506,6 @@ if (ENABLE_EGL AND NOT WIN32 AND NOT APPLE)
 
     add_dependencies (egltrace glproc)
 
-    set_property (
-        TARGET egltrace
-        APPEND
-        PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
-    )
-
     set_target_properties (egltrace PROPERTIES
         # avoid the default "lib" prefix
         PREFIX ""
@@ -552,7 +542,7 @@ add_custom_command (
     DEPENDS glstate_params.py specs/glparams.py specs/gltypes.py specs/stdapi.py
 )
 
-set (retrace_sources
+add_library (retrace_common
     glretrace_gl.cpp
     glretrace_cgl.cpp
     glretrace_glx.cpp
@@ -568,9 +558,14 @@ set (retrace_sources
     glws.cpp
 )
 
+set_property (
+    TARGET retrace_common
+    APPEND
+    PROPERTY COMPILE_DEFINITIONS "RETRACE"
+)
+
 if (WIN32 OR APPLE OR X11_FOUND)
     add_executable (glretrace
-        ${retrace_sources}
         ${glws_os}
         glproc_gl.cpp
     )
@@ -584,6 +579,7 @@ if (WIN32 OR APPLE OR X11_FOUND)
     )
 
     target_link_libraries (glretrace
+        retrace_common
         common
         ${PNG_LIBRARIES}
         ${ZLIB_LIBRARIES}
@@ -621,7 +617,6 @@ endif ()
 
 if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE)
     add_executable (eglretrace
-        ${retrace_sources}
         glws_egl_xlib.cpp
         glproc_egl.cpp
     )
@@ -632,10 +627,10 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE)
         TARGET eglretrace
         APPEND
         PROPERTY COMPILE_DEFINITIONS "RETRACE"
-        PROPERTY COMPILE_DEFINITIONS "TRACE_EGL"
     )
 
     target_link_libraries (eglretrace
+        retrace_common
         common
         ${PNG_LIBRARIES}
         ${ZLIB_LIBRARIES}