CMake module: Allow paths of generated CMake sources for include directories

0.55
Sebastian Würl 4 years ago committed by Nirbheek Chauhan
parent 96be8196f2
commit 3998bd6640
  1. 8
      mesonbuild/cmake/interpreter.py
  2. 9
      test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt
  3. 3
      test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp
  4. 3
      test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest5.hpp

@ -432,6 +432,14 @@ 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:
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

@ -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)

@ -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;
}

@ -0,0 +1,3 @@
#pragma once
#define CPY_TEST_STR_5 " test"
Loading…
Cancel
Save