[CMAKE] Use configured include files to define the __RELFILE__ hack (#979)
authorJérôme Gardou <zefklop@users.noreply.github.com>
Fri, 26 Oct 2018 11:47:22 +0000 (13:47 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Oct 2018 11:47:22 +0000 (13:47 +0200)
[CMAKE] Use configured include files to define the __RELFILE__ hack

It's easier on the command line and the eyes looking at it

CMakeLists.txt
sdk/include/reactos/builddir.h.cmake [new file with mode: 0644]
sdk/include/reactos/debug.h
sdk/include/reactos/version.cmake
sdk/include/reactos/wine/debug.h

index d2e8b86..f79577f 100644 (file)
@@ -57,9 +57,6 @@ endif()
 include(sdk/cmake/compilerflags.cmake)
 
 add_definitions(-D__REACTOS__)
 include(sdk/cmake/compilerflags.cmake)
 
 add_definitions(-D__REACTOS__)
-add_definitions(-DREACTOS_SOURCE_DIR="\\"${REACTOS_SOURCE_DIR}\\"")
-add_definitions(-DREACTOS_BINARY_DIR="\\"${REACTOS_BINARY_DIR}\\"")
-add_compile_flags(-D__RELFILE__="&__FILE__[sizeof REACTOS_SOURCE_DIR]")
 
 if(MSVC_IDE)
     add_compile_flags("/MP")
 
 if(MSVC_IDE)
     add_compile_flags("/MP")
diff --git a/sdk/include/reactos/builddir.h.cmake b/sdk/include/reactos/builddir.h.cmake
new file mode 100644 (file)
index 0000000..8bd5b44
--- /dev/null
@@ -0,0 +1,7 @@
+/* Do not edit - Machine generated */
+#pragma once
+
+#define REACTOS_SOURCE_DIR        "@REACTOS_SOURCE_DIR@"
+#define REACTOS_BINARY_DIR        "@REACTOS_BINARY_DIR@"
+
+/* EOF */
index ab332fd..f56090b 100644 (file)
 #pragma once
 
 #ifndef __RELFILE__
 #pragma once
 
 #ifndef __RELFILE__
-#define __RELFILE__ __FILE__
+#   ifdef __REACTOS__
+#       include <reactos/builddir.h>
+#       define __RELFILE__ &__FILE__[sizeof(REACTOS_SOURCE_DIR)]
+#   else
+#       define __RELFILE__ __FILE__
+#   endif
 #endif
 
 /* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
 #endif
 
 /* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
index 9314a56..46a4247 100644 (file)
@@ -53,3 +53,4 @@ endif()
 
 configure_file(sdk/include/reactos/version.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/version.h)
 configure_file(sdk/include/reactos/buildno.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/buildno.h)
 
 configure_file(sdk/include/reactos/version.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/version.h)
 configure_file(sdk/include/reactos/buildno.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/buildno.h)
+configure_file(sdk/include/reactos/builddir.h.cmake ${REACTOS_BINARY_DIR}/sdk/include/reactos/builddir.h)
index 35aefc9..23f402a 100644 (file)
 #endif
 
 #ifndef __RELFILE__
 #endif
 
 #ifndef __RELFILE__
-#define __RELFILE__ __FILE__
+#      ifdef __REACTOS__
+#              include <reactos/builddir.h>
+#              define __RELFILE__ &__FILE__[sizeof(REACTOS_SOURCE_DIR)]
+#      else
+#              define __RELFILE__ __FILE__
+#      endif
 #endif
 
 #ifdef __WINE_WINE_TEST_H
 #endif
 
 #ifdef __WINE_WINE_TEST_H