Subject: [PATCH] BUGFIX: Failed to get proper output dir for test-server
authorJoakim Soderberg <joakim.soderberg@gmail.com>
Tue, 14 Oct 2014 13:24:31 +0000 (15:24 +0200)
committerAndy Green <andy.green@linaro.org>
Mon, 24 Nov 2014 21:49:11 +0000 (05:49 +0800)
When creating the directory where to put the files needed by the test-server CMake would fail because it tried to create the directory /../share/libwebsockets-test-server, which is not possible. This happens since the TARGET_FILE_DIR for the test-server is not fetched properly.

Also mentioned in this trac ticket:
http://libwebsockets.org/trac/libwebsockets/ticket/84

CMakeLists.txt
test-server/test-server.c

index 875da83..93d2200 100644 (file)
@@ -685,7 +685,9 @@ if (NOT LWS_WITHOUT_TESTAPPS)
 
                add_custom_command(TARGET test-server
                                                POST_BUILD 
-                                               COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server")
+                                               COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server"
+                                               COMMENT "Creating test-server $<TARGET_FILE_DIR:test-server> share directory"
+                                               VERBATIM)
 
                # Copy the file needed to run the server so that the test apps can
                # reach them from their default output location
@@ -693,7 +695,9 @@ if (NOT LWS_WITHOUT_TESTAPPS)
                        if (EXISTS ${TEST_FILE})
                                add_custom_command(TARGET test-server
                                                        POST_BUILD 
-                                                       COMMAND "${CMAKE_COMMAND}" -E copy "${TEST_FILE}" "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server" VERBATIM)
+                                                       COMMAND "${CMAKE_COMMAND}" -E copy "${TEST_FILE}" "$<TARGET_FILE_DIR:test-server>/../share/libwebsockets-test-server"
+                                                       COMMENT "Copying test-server files"
+                                                       VERBATIM)
                        endif()
                endforeach()
        endif(NOT LWS_WITHOUT_SERVER)
index 7b5a29d..6183117 100644 (file)
@@ -876,6 +876,8 @@ int main(int argc, char **argv)
        lwsl_notice("libwebsockets test server - "
                        "(C) Copyright 2010-2014 Andy Green <andy@warmcat.com> - "
                                                    "licensed under LGPL2.1\n");
+
+       printf("Using resource path \"%s\"\n", resource_path);
 #ifdef EXTERNAL_POLL
        max_poll_elements = getdtablesize();
        pollfds = malloc(max_poll_elements * sizeof (struct pollfd));