From 306e3e573fe409c0818fa069fd7e625c19713ed9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Jun 2008 12:10:59 -0400 Subject: ENH: Add test for make variable replacement in a custom command with the VERBATIM option. --- Tests/CustomCommand/CMakeLists.txt | 2 ++ Tests/CustomCommand/wrapper.cxx | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 7e9f29c..5d785bc 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -42,6 +42,8 @@ ADD_CUSTOM_COMMAND( MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/wrapped.h COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/wrapper ${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c + ${CMAKE_CFG_INTDIR} # this argument tests passing of the configuration + VERBATIM # passing of configuration should work in this mode ) ################################################################ diff --git a/Tests/CustomCommand/wrapper.cxx b/Tests/CustomCommand/wrapper.cxx index 3ad0794..97912de 100644 --- a/Tests/CustomCommand/wrapper.cxx +++ b/Tests/CustomCommand/wrapper.cxx @@ -1,4 +1,5 @@ #include +#include int main(int argc, char *argv[]) { @@ -14,5 +15,16 @@ int main(int argc, char *argv[]) fp = fopen(argv[2],"w"); fprintf(fp,"int wrapped_help() { return 5; }\n"); fclose(fp); +#ifdef CMAKE_INTDIR + const char* cfg = (argc >= 4)? argv[3] : ""; + if(strcmp(cfg, CMAKE_INTDIR) != 0) + { + fprintf(stderr, + "Did not receive expected configuration argument:\n" + " expected [" CMAKE_INTDIR "]\n" + " received [%s]\n", cfg); + return 1; + } +#endif return 0; } -- cgit v0.12