Only for debug builds.  Release must be installed.
 )
 
 set_target_properties (common PROPERTIES
-    COMPILE_DEFINITIONS APITRACE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
     # Ensure it can be statically linked in shared libraries
     COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}"
 )
 
     ${GETOPT_LIBRARIES}
 )
 
+if (NOT CMAKE_CROSSCOMPILING)
+    set_target_properties (apitrace PROPERTIES
+        # On debug builds tell where the source is so that scripts can be found
+        COMPILE_DEFINITIONS_DEBUG APITRACE_SOURCE_DIR="${CMAKE_SOURCE_DIR}"
+    )
+endif ()
+
 install (TARGETS apitrace RUNTIME DESTINATION bin)
 
 
     // Try relative build directory
     // XXX: Just make build and install directory layout match
-    scriptPath = processDir;
+#if defined(APITRACE_SOURCE_DIR)
+    scriptPath = APITRACE_SOURCE_DIR;
     scriptPath.join("scripts");
     scriptPath.join(scriptFilename);
     if (scriptPath.exists()) {
         return scriptPath;
     }
+#endif
 
     // Try relative install directory
     scriptPath = processDir;