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 259151c2c..ec56105df 100644 --- a/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/8 custom command/subprojects/cmMod/CMakeLists.txt @@ -44,3 +44,13 @@ add_custom_command( add_library(cmModLib SHARED cmMod.cpp genTest.cpp cpyBase.cpp cpyBase.hpp) include(GenerateExportHeader) generate_export_header(cmModLib) + +set(ARGS_TEST arg1) +set(ARGS_TEST ${ARGS_TEST} arg2) + +add_executable(args_test args_test.cpp) +add_custom_target(args_test_cmd + COMMAND args_test ARGS ${ARGS_TEST} +) + +add_dependencies(cmModLib args_test_cmd) diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp new file mode 100644 index 000000000..243e59706 --- /dev/null +++ b/test cases/cmake/8 custom command/subprojects/cmMod/args_test.cpp @@ -0,0 +1,17 @@ +#include +#include + +using namespace std; + +int main(int argc, const char *argv[]) { + if(argc != 3 || string(argv[1]) != "arg1" || string(argv[2]) != "arg2") { + cerr << argv[0] << " requires 2 args" << endl; + return 1; + } + + ofstream out1("cmModLib.hpp"); + out1 << "#define FOO = \"plop\""; + + + return 0; +} diff --git a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp index 0fb6aa724..b7e8200d7 100644 --- a/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp +++ b/test cases/cmake/8 custom command/subprojects/cmMod/cmMod.cpp @@ -1,6 +1,11 @@ #include "cmMod.hpp" #include "genTest.hpp" #include "cpyBase.hpp" +#include "cmModLib.hpp" + +#ifndef FOO +#error FOO not declared +#endif using namespace std;