devilutionX: fix build with ninja

This commit is contained in:
John 2021-02-08 16:57:15 +01:00
parent 731dc99e99
commit 5d829a5168
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From 201c6fe89ea1977aa296277694a6e94314aca0a8 Mon Sep 17 00:00:00 2001
From: Alex Sweet <sweet.giorni@gmail.com>
Date: Mon, 23 Mar 2020 01:59:33 -0700
Subject: [PATCH] Fix ninja-build build error
---
CMakeLists.txt | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8f0c4492..89051b7bc 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -502,8 +502,14 @@ endif()
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# Change __FILE__ to only show the path relative to the project folder
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined -D'__FILE__=\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"'")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined -D'__FILE__=\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"'")
+ get_target_property(devilution_SRCS devilution SOURCES)
+ foreach(SOURCE_FILE ${devilution_SRCS} ${devilutionx_SRCS})
+ set_source_files_properties(${SOURCE_FILE} PROPERTIES
+ COMPILE_DEFINITIONS __FILE__="${SOURCE_FILE}"
+ )
+ endforeach(SOURCE_FILE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined")
if(DEBUG)
# Note: For Valgrind suppor.