[cmake-commits] king committed generator.cxx NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 23 13:30:25 EDT 2007


Update of /cvsroot/CMake/CMake/Tests/BuildDepends/Project
In directory public:/mounts/ram/cvs-serv12136

Added Files:
	generator.cxx 
Log Message:
BUG: Target names in the COMMAND part of a custom command should not create a file-level dependency that forces the command to rerun when the executable target rebuilds, but the target-level dependency should still be created.  Target names in a DEPENDS should do both a target-level and file-level dependency.  Updated the BuildDepends test to check that this works.


--- NEW FILE: generator.cxx ---
#include <stdio.h>

extern const char* foo();

int main(int argc, const char* argv[])
{
  if(argc < 3)
    {
    fprintf(stderr, "Must specify output file and symbol prefix!");
    return 1;
    }
  if(FILE* fout = fopen(argv[1], "w"))
    {
    fprintf(fout, "static const char* %s_string = \"%s\";\n", argv[2],
            foo());
    fclose(fout);
    }
  else
    {
    fprintf(stderr, "Could not open output file \"%s\"", argv[1]);
    return 1;
    }
  return 0;
}



More information about the Cmake-commits mailing list