aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/cmake/interpreter.py14
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt9
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp3
-rw-r--r--test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp3
4 files changed, 24 insertions, 5 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index c2affd0..8a7122d 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -432,9 +432,17 @@ class ConverterTarget:
if not os.path.isabs(x):
x = os.path.normpath(os.path.join(self.src_dir, x))
if not os.path.exists(x) and not any([x.endswith(y) for y in obj_suffixes]) and not is_generated:
- mlog.warning('CMake: path', mlog.bold(x), 'does not exist.')
- mlog.warning(' --> Ignoring. This can lead to build errors.')
- return None
+ if (
+ any([os.path.commonpath([x, y]) == x for y in self.generated])
+ and os.path.isabs(x)
+ and os.path.commonpath([x, self.env.get_build_dir()]) == self.env.get_build_dir()
+ ):
+ os.makedirs(x)
+ return os.path.relpath(x, os.path.join(self.env.get_build_dir(), subdir))
+ else:
+ mlog.warning('CMake: path', mlog.bold(x), 'does not exist.')
+ mlog.warning(' --> Ignoring. This can lead to build errors.')
+ return None
if Path(x) in trace.explicit_headers:
return None
if (
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
index 199c2e9..e27a469 100644
--- a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
@@ -120,7 +120,14 @@ add_custom_command(
add_subdirectory(cpyTest ccppyyTTeesstt)
-add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp cpyNext.cpp cpyNext.hpp cpyTest.cpp cpyTest.hpp cpyTest2.hpp cpyTest3.hpp)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp" "${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some/directory/cpyTest5.hpp"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest/cpyTest5.hpp"
+)
+include_directories("${CMAKE_CURRENT_BINARY_DIR}/cpyTest/some")
+
+add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp cpyNext.cpp cpyNext.hpp cpyTest.cpp cpyTest.hpp cpyTest2.hpp cpyTest3.hpp cpyTest/some/directory/cpyTest5.hpp)
include(GenerateExportHeader)
generate_export_header(cmModLib)
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
index f762251..627b8f9 100644
--- a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
@@ -2,7 +2,8 @@
#include "cpyTest2.hpp"
#include "cpyTest3.hpp"
#include "ccppyyTTeesstt/cpyTest4.hpp"
+#include "directory/cpyTest5.hpp"
std::string getStrCpyTest() {
- return CPY_TEST_STR_2 CPY_TEST_STR_3 CPY_TEST_STR_4;
+ return CPY_TEST_STR_2 CPY_TEST_STR_3 CPY_TEST_STR_4 CPY_TEST_STR_5;
}
diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp
new file mode 100644
index 0000000..3669f00
--- /dev/null
+++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CPY_TEST_STR_5 " test"