[FONTS] Add Source Sans font family.
[reactos.git] / CMakeLists.txt
index 44e8566..3b66140 100644 (file)
@@ -17,6 +17,11 @@ if(POLICY CMP0058)
     cmake_policy(SET CMP0058 OLD)
 endif()
 
+if(POLICY CMP0065)
+    # Do not add flags to export symbols from executables without the ENABLE_EXPORTS target property
+    cmake_policy(SET CMP0065 NEW)
+endif()
+
 project(REACTOS)
 
 # Versioning
@@ -25,6 +30,7 @@ include(sdk/include/reactos/version.cmake)
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 set(CMAKE_SHARED_LIBRARY_PREFIX "")
+set(CMAKE_SHARED_MODULE_PREFIX "")
 set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
 set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
 set(CMAKE_COLOR_MAKEFILE OFF)
@@ -57,9 +63,14 @@ endif()
 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]")
+
+# Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
+add_definitions(-DREACTOS_SOURCE_DIR="\\\"${REACTOS_SOURCE_DIR}\\\"")
+add_definitions(-DREACTOS_BINARY_DIR="\\\"${REACTOS_BINARY_DIR}\\\"")
+
+# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
+file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
+add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]")
 
 if(MSVC_IDE)
     add_compile_flags("/MP")
@@ -78,7 +89,9 @@ if(NOT CMAKE_CROSSCOMPILING)
 
     if(MSVC)
         if(ARCH STREQUAL "i386")
-            add_definitions(/D_X86_ /DWIN32 /D_WINDOWS)
+            add_definitions(/D_X86_ /D__i386__ /DWIN32 /D_WINDOWS)
+        elseif(ARCH STREQUAL "amd64")
+            add_definitions(-D_AMD64_ -D__x86_64__ /DWIN32 -D_WINDOWS)
         endif()
         if(MSVC_VERSION GREATER 1699)
             add_definitions(/D_ALLOW_KEYWORD_MACROS)
@@ -106,11 +119,8 @@ if(NOT CMAKE_CROSSCOMPILING)
     endif()
 
 else()
-       # We don't need CMake importlib handling.
-       # FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.
-       if(NOT MSVC_IDE)
-               unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
-       endif()
+    # We don't need CMake importlib handling.
+    unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
 
     if(NEW_STYLE_BUILD)
         include(sdk/cmake/host-tools.cmake)