[Cmake-commits] [cmake-commits] king committed cmIfCommand.cxx 1.84 1.85 cmIfCommand.h 1.46 1.47
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Mar 20 18:26:01 EDT 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv32651/Source
Modified Files:
cmIfCommand.cxx cmIfCommand.h
Log Message:
ENH: Add "if(POLICY policy-id)" option for IF command.
- This will help projects support multiple CMake versions.
- In order to set a policy when using a newer CMake but still
working with an older CMake one may write
if(POLICY CMP1234)
cmake_policy(SET CMP1234 NEW)
endif(POLICY CMP1234)
- Note that since CMake 2.4 does not have if(POLICY) supporting
it will also require using "if(COMMAND cmake_policy)"
Index: cmIfCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.cxx,v
retrieving revision 1.84
retrieving revision 1.85
diff -C 2 -d -r1.84 -r1.85
*** cmIfCommand.cxx 1 Mar 2008 02:33:33 -0000 1.84
--- cmIfCommand.cxx 20 Mar 2008 22:25:59 -0000 1.85
***************
*** 358,361 ****
--- 358,378 ----
reducible = 1;
}
+ // does a policy exist
+ if (*arg == "POLICY" && argP1 != newArgs.end())
+ {
+ cmPolicies::PolicyID pid;
+ if(makefile->GetPolicies()->GetPolicyID((argP1)->c_str(), pid))
+ {
+ *arg = "1";
+ }
+ else
+ {
+ *arg = "0";
+ }
+ newArgs.erase(argP1);
+ argP1 = arg;
+ IncrementArguments(newArgs,argP1,argP2);
+ reducible = 1;
+ }
// is a variable defined
if (*arg == "DEFINED" && argP1 != newArgs.end())
Index: cmIfCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIfCommand.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -C 2 -d -r1.46 -r1.47
*** cmIfCommand.h 10 Feb 2008 22:19:10 -0000 1.46
--- cmIfCommand.h 20 Mar 2008 22:25:59 -0000 1.47
***************
*** 140,143 ****
--- 140,146 ----
"True if the given name is a command, macro or function that can be "
"invoked.\n"
+ " if(POLICY policy-id)\n"
+ "True if the given name is an existing policy "
+ "(of the form CMP<NNNN>).\n"
" if(EXISTS file-name)\n"
" if(EXISTS directory-name)\n"
More information about the Cmake-commits
mailing list