[Cmake-commits] [cmake-commits] king committed cmAddCustomTargetCommand.cxx 1.37 1.38 cmAddCustomTargetCommand.h 1.22 1.23
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Oct 9 11:01:25 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv25743/Source
Modified Files:
cmAddCustomTargetCommand.cxx cmAddCustomTargetCommand.h
Log Message:
ENH: Allow custom sources in custom targets
This adds a SOURCES option to ADD_CUSTOM_TARGET, enabling users to
specify extra sources for inclusion in the target. Such sources may not
build, but will show up in the IDE project files for convenient editing.
See issue #5848.
Index: cmAddCustomTargetCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomTargetCommand.cxx,v
retrieving revision 1.37
retrieving revision 1.38
diff -C 2 -d -r1.37 -r1.38
*** cmAddCustomTargetCommand.cxx 7 Mar 2008 22:05:06 -0000 1.37
--- cmAddCustomTargetCommand.cxx 9 Oct 2008 15:01:23 -0000 1.38
***************
*** 56,59 ****
--- 56,60 ----
std::string comment_buffer;
const char* comment = 0;
+ std::vector<std::string> sources;
// Keep track of parser state.
***************
*** 63,66 ****
--- 64,68 ----
doing_working_directory,
doing_comment,
+ doing_source,
doing_verbatim
};
***************
*** 112,115 ****
--- 114,121 ----
}
}
+ else if(copy == "SOURCES")
+ {
+ doing = doing_source;
+ }
else
{
***************
*** 129,132 ****
--- 135,141 ----
comment = comment_buffer.c_str();
break;
+ case doing_source:
+ sources.push_back(copy);
+ break;
default:
this->SetError("Wrong syntax. Unknown type of argument.");
***************
*** 165,171 ****
// Add the utility target to the makefile.
bool escapeOldStyle = !verbatim;
! this->Makefile->AddUtilityCommand(args[0].c_str(), excludeFromAll,
! working_directory.c_str(), depends,
! commandLines, escapeOldStyle, comment);
return true;
--- 174,184 ----
// Add the utility target to the makefile.
bool escapeOldStyle = !verbatim;
! cmTarget* target =
! this->Makefile->AddUtilityCommand(args[0].c_str(), excludeFromAll,
! working_directory.c_str(), depends,
! commandLines, escapeOldStyle, comment);
!
! // Add additional user-specified source files to the target.
! target->AddSources(sources);
return true;
Index: cmAddCustomTargetCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddCustomTargetCommand.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C 2 -d -r1.22 -r1.23
*** cmAddCustomTargetCommand.h 23 Jan 2008 15:27:59 -0000 1.22
--- cmAddCustomTargetCommand.h 9 Oct 2008 15:01:23 -0000 1.23
***************
*** 69,73 ****
" [DEPENDS depend depend depend ... ]\n"
" [WORKING_DIRECTORY dir]\n"
! " [COMMENT comment] [VERBATIM])\n"
"Adds a target with the given name that executes the given commands. "
"The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
--- 69,74 ----
" [DEPENDS depend depend depend ... ]\n"
" [WORKING_DIRECTORY dir]\n"
! " [COMMENT comment] [VERBATIM]\n"
! " [SOURCES src1 [src2...]])\n"
"Adds a target with the given name that executes the given commands. "
"The target has no output file and is ALWAYS CONSIDERED OUT OF DATE "
***************
*** 95,99 ****
"When VERBATIM is not given the behavior is platform specific. "
"In the future VERBATIM may be enabled by default. The only reason "
! "it is an option is to preserve compatibility with older CMake code.";
}
--- 96,106 ----
"When VERBATIM is not given the behavior is platform specific. "
"In the future VERBATIM may be enabled by default. The only reason "
! "it is an option is to preserve compatibility with older CMake code."
! "\n"
! "The SOURCES option specifies additional source files to be included "
! "in the custom target. "
! "Specified source files will be added to IDE project files for "
! "convenience in editing even if they have not build rules."
! ;
}
More information about the Cmake-commits
mailing list