Properly escaping __FILE__ replacement.

This commit is contained in:
Armin Novak 2016-10-11 11:13:54 +02:00
parent 5a5f091b7c
commit 12aae5013a

View File

@ -71,7 +71,7 @@ include(CMakePackageConfigHelpers)
# Soname versioning
set(BUILD_NUMBER 0)
if ($ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
endif()
set(WITH_LIBRARY_VERSIONING "ON")
set(FREERDP_VERSION_MAJOR "2")
@ -135,14 +135,14 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
endif()
if(BUILD_TESTING)
set(EXPORT_ALL_SYMBOLS TRUE)
set(EXPORT_ALL_SYMBOLS TRUE)
elseif(NOT DEFINED EXPORT_ALL_SYMBOLS)
set(EXPORT_ALL_SYMBOLS FALSE)
set(EXPORT_ALL_SYMBOLS FALSE)
endif()
if (EXPORT_ALL_SYMBOLS)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-DFREERDP_TEST_EXPORTS -DBUILD_TESTING)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-DFREERDP_TEST_EXPORTS -DBUILD_TESTING)
endif(EXPORT_ALL_SYMBOLS)
# BSD
@ -235,18 +235,19 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(FILE_SUBST "\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"")
add_definitions(-DNDEBUG)
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
if(Wno-builtin-macro-redefined)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-builtin-macro-redefined")
add_definitions("-D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
add_definitions("-D__FILE__=${FILE_SUBST}")
endif()
CHECK_CXX_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefinedCXX)
if(Wno-builtin-macro-redefinedCXX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-builtin-macro-redefined")
add_definitions("-D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'")
add_definitions("-D__FILE__=${FILE_SUBST}")
endif()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
@ -487,7 +488,7 @@ endif()
if(ANDROID)
set(WITH_LIBRARY_VERSIONING "OFF")
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF)
@ -808,7 +809,7 @@ endif()
include(CTest)
if(BUILD_TESTING)
enable_testing()
enable_testing()
if(MSVC)
set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
@ -860,7 +861,7 @@ include_directories("${CMAKE_BINARY_DIR}/rdtk/include")
add_subdirectory(rdtk)
if(WAYLAND_FOUND)
add_subdirectory(uwac)
add_subdirectory(uwac)
endif()
if(BSD)
@ -906,9 +907,9 @@ include(${CMAKE_CPACK_INCLUDE_FILE})
set(FREERDP_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()
string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h)