]> git.cworth.org Git - apitrace/commitdiff
cli: Fix script search for out of source build.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 10 Apr 2013 15:20:30 +0000 (16:20 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 10 Apr 2013 15:20:50 +0000 (16:20 +0100)
Only for debug builds.  Release must be installed.

CMakeLists.txt
cli/CMakeLists.txt
cli/cli_resources.cpp

index ccaddd0556885d6e27b414c218a54ba9142ce2ac..9394282c591062bdc931a054a3c01b6a4d3941d4 100644 (file)
@@ -317,7 +317,6 @@ add_library (common STATIC
 )
 
 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}"
 )
index 5f8e116f5279e385ba1875ed659246bbf2c10d79..689374dc5333ade934d45ea2a398e57d7182cec5 100644 (file)
@@ -33,4 +33,11 @@ target_link_libraries (apitrace
     ${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)
index 255a98b662a700a440750a62e200553c4b193b16..a533b01e0300910b42e0bc27347fd80838e58be5 100644 (file)
@@ -112,12 +112,14 @@ findScript(const char *scriptFilename)
 
     // 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;