cmake: improve __FILE__ relative path hack
This commit is contained in:
parent
b15e77c18b
commit
784e9abd79
@ -20,7 +20,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(FreeRDP C)
|
||||
project(FreeRDP C CXX)
|
||||
|
||||
if(NOT DEFINED VENDOR)
|
||||
set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor")
|
||||
@ -116,6 +116,15 @@ if(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
|
||||
if(Wno-builtin-macro-redefined)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
|
||||
endif()
|
||||
|
||||
# Compiler-specific flags
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
|
||||
@ -134,15 +143,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
|
||||
# Hack to strip absolute paths out of the __FILE__ macro
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
|
||||
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
|
||||
if(Wno-builtin-macro-redefined)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined")
|
||||
endif()
|
||||
|
||||
CHECK_C_COMPILER_FLAG (-Wno-unused-result Wno-unused-result)
|
||||
if(Wno-unused-result)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -160,8 +159,11 @@ static void* rdpei_schedule_thread(void* arg)
|
||||
RdpeiClientContext* context = (RdpeiClientContext*) rdpei->iface.pInterface;
|
||||
HANDLE hdl[] = {rdpei->event, rdpei->stopEvent};
|
||||
|
||||
assert(NULL != rdpei);
|
||||
assert(NULL != context);
|
||||
if (!rdpei)
|
||||
return NULL;
|
||||
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -516,7 +518,8 @@ static int rdpei_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
|
||||
DEBUG_DVC("");
|
||||
|
||||
assert(NULL != pPlugin);
|
||||
if (!pPlugin)
|
||||
return -1;
|
||||
|
||||
SetEvent(rdpei->stopEvent);
|
||||
EnterCriticalSection(&rdpei->lock);
|
||||
|
@ -27,11 +27,14 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#include "TPCircularBuffer.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define reportResult(result,operation) (_reportResult((result),(operation),strrchr(__FILE__, '/')+1,__LINE__))
|
||||
#define reportResult(result,operation) (_reportResult((result),(operation),__FILE__,__LINE__))
|
||||
static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) {
|
||||
if ( result != ERR_SUCCESS ) {
|
||||
printf("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result));
|
||||
|
@ -841,7 +841,7 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
fprintf(stderr, "--authonly, but no -p password. Please provide one.\n");
|
||||
return FALSE;
|
||||
}
|
||||
fprintf(stderr, "%s:%d: Authentication only. Don't connect to X.\n", __FILE__, __LINE__);
|
||||
fprintf(stderr, "Authentication only. Don't connect to X.\n");
|
||||
/* Avoid XWindows initialization and configuration below. */
|
||||
return TRUE;
|
||||
}
|
||||
@ -1457,7 +1457,7 @@ void* xf_thread(void* param)
|
||||
if (instance->settings->AuthenticationOnly)
|
||||
{
|
||||
freerdp_disconnect(instance);
|
||||
fprintf(stderr, "%s:%d: Authentication only, exit status %d\n", __FILE__, __LINE__, !status);
|
||||
fprintf(stderr, "Authentication only, exit status %d\n", !status);
|
||||
ExitThread(exit_code);
|
||||
}
|
||||
|
||||
|
8
libfreerdp/cache/brush.c
vendored
8
libfreerdp/cache/brush.c
vendored
@ -22,7 +22,6 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/update.h>
|
||||
@ -91,8 +90,11 @@ void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp)
|
||||
{
|
||||
void* entry;
|
||||
|
||||
assert(brushCache);
|
||||
assert(bpp);
|
||||
if (!brushCache)
|
||||
return NULL;
|
||||
|
||||
if (!bpp)
|
||||
return NULL;
|
||||
|
||||
if (*bpp == 1)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ BOOL freerdp_connect(freerdp* instance)
|
||||
freerdp_set_last_error(instance->context, FREERDP_ERROR_PRE_CONNECT_FAILED);
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s:%d: freerdp_pre_connect failed\n", __FILE__, __LINE__);
|
||||
fprintf(stderr, "freerdp_pre_connect failed\n");
|
||||
|
||||
goto freerdp_connect_finally;
|
||||
}
|
||||
@ -100,7 +100,7 @@ BOOL freerdp_connect(freerdp* instance)
|
||||
/* --authonly tests the connection without a UI */
|
||||
if (instance->settings->AuthenticationOnly)
|
||||
{
|
||||
fprintf(stderr, "%s:%d: Authentication only, exit status %d\n", __FILE__, __LINE__, !status);
|
||||
fprintf(stderr, "Authentication only, exit status %d\n", !status);
|
||||
goto freerdp_connect_finally;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,8 @@ endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
|
||||
|
||||
if(FREERDP_BUILD)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include PARENT_SCOPE)
|
||||
else()
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
endif()
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/winpr/config.h)
|
||||
|
Loading…
Reference in New Issue
Block a user