diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-02-19 20:05:19 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-02-20 11:16:37 +0100 |
commit | 113ec96626fe7cd2edc0bc4815ae2fc21cfb0546 (patch) | |
tree | c793ed45ea352e1f4ceb9ef279f6f96ab64e526c /test cases | |
parent | 31eb41ec2fd2c7ed06406fb4e5ea87af5010d4e5 (diff) | |
download | meson-113ec96626fe7cd2edc0bc4815ae2fc21cfb0546.zip meson-113ec96626fe7cd2edc0bc4815ae2fc21cfb0546.tar.gz meson-113ec96626fe7cd2edc0bc4815ae2fc21cfb0546.tar.bz2 |
cmake: Fix relative paths for add_custom_{command,target}
Do this by tracking CMAKE_CURRENT_{SOURCE,BINARY}_DIR variables.
This is achieved by injecting CMake code with CMAKE_PROJECT_INCLUDE
and overriding some builtin functions with a wrapper that adds
additional trace information.
Diffstat (limited to 'test cases')
4 files changed, 15 insertions, 2 deletions
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 70ac236..c7797db 100644 --- a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt @@ -109,6 +109,8 @@ add_custom_command( WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest" ) +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) include(GenerateExportHeader) generate_export_header(cmModLib) @@ -123,5 +125,5 @@ add_custom_target(args_test_cmd ) add_custom_target(macro_name_cmd COMMAND macro_name) -add_dependencies(cmModLib args_test_cmd) +add_dependencies(cmModLib args_test_cmd tgtCpyTest4) add_dependencies(args_test_cmd macro_name_cmd;gen;mycpy) 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 a9d05c7..f762251 100644 --- a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest.cpp @@ -1,7 +1,8 @@ #include "cpyTest.hpp" #include "cpyTest2.hpp" #include "cpyTest3.hpp" +#include "ccppyyTTeesstt/cpyTest4.hpp" std::string getStrCpyTest() { - return CPY_TEST_STR_2 CPY_TEST_STR_3; + return CPY_TEST_STR_2 CPY_TEST_STR_3 CPY_TEST_STR_4; } diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt new file mode 100644 index 0000000..f577dcf --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/CMakeLists.txt @@ -0,0 +1,7 @@ +add_custom_command( + OUTPUT cpyTest4.hpp + COMMAND mycpy "${CMAKE_CURRENT_SOURCE_DIR}/cpyTest4.hpp" cpyTest4.hpp + DEPENDS cpyTest4.hpp +) + +add_custom_target(tgtCpyTest4 DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/cpyTest4.hpp") diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp new file mode 100644 index 0000000..4124c43 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cpyTest/cpyTest4.hpp @@ -0,0 +1,3 @@ +#pragma once + +#define CPY_TEST_STR_4 " test" |