Browse Source

Merge topic 'fix-configure_file-COPYONLY'

1531df2b configure_file: Warn about unknown arguments
4abbb140 Qt4: Fix configure_file call to use COPYONLY, not COPY_ONLY
bd7ba8e2 KWSys: Fix configure_file call to use COPYONLY, not COPY_ONLY
e9282782 Help: Fix configure_file call to use COPYONLY, not COPY_ONLY
Brad King 11 years ago
parent
commit
6aa2d47737

+ 1 - 1
Help/manual/cmake-packages.7.rst

@@ -316,7 +316,7 @@ shared library:
   )
   configure_file(cmake/ClimbingStatsConfig.cmake
     "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake"
-    COPY_ONLY
+    COPYONLY
   )
 
   set(ConfigPackageLocation lib/cmake/ClimbingStats)

+ 1 - 1
Modules/Qt4Macros.cmake

@@ -232,7 +232,7 @@ macro (QT4_ADD_RESOURCES outfiles )
       # let's make a configured file and add it as a dependency so cmake is run
       # again when dependencies need to be recomputed.
       QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends)
-      configure_file("${infile}" "${out_depends}" COPY_ONLY)
+      configure_file("${infile}" "${out_depends}" COPYONLY)
     else()
       # The .qrc file does not exist (yet). Let's add a dependency and hope
       # that it will be generated later

+ 13 - 0
Source/cmConfigureFileCommand.cxx

@@ -74,6 +74,7 @@ bool cmConfigureFileCommand
   this->CopyOnly = false;
   this->EscapeQuotes = false;
 
+  std::string unknown_args;
   this->AtOnly = false;
   for(unsigned int i=2;i < args.size();++i)
     {
@@ -99,6 +100,18 @@ bool cmConfigureFileCommand
       {
       /* Ignore legacy option.  */
       }
+    else
+      {
+      unknown_args += " ";
+      unknown_args += args[i];
+      unknown_args += "\n";
+      }
+    }
+  if (!unknown_args.empty())
+    {
+    std::string msg = "configure_file called with unknown argument(s):\n";
+    msg += unknown_args;
+    this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
     }
 
   if ( !this->ConfigureFile() )

+ 1 - 1
Source/kwsys/CMakeLists.txt

@@ -265,7 +265,7 @@ STRING(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}"
   KWSYS_IN_SOURCE_BUILD)
 IF(NOT KWSYS_IN_SOURCE_BUILD)
   CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h
-    ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
+    ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE)
 ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
 
 # Select plugin module file name convention.

+ 1 - 0
Tests/RunCMake/configure_file/RunCMakeTest.cmake

@@ -6,3 +6,4 @@ run_cmake(UTF16LE-BOM)
 run_cmake(UTF16BE-BOM)
 run_cmake(UTF32LE-BOM)
 run_cmake(UTF32BE-BOM)
+run_cmake(UnknownArg)

+ 10 - 0
Tests/RunCMake/configure_file/UnknownArg-stderr.txt

@@ -0,0 +1,10 @@
+CMake Warning \(dev\) at UnknownArg.cmake:1 \(configure_file\):
+  configure_file called with unknown argument\(s\):
+
+   COPY_ONLY
+   COPYFILE
+   COPY_FILE
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.

+ 2 - 0
Tests/RunCMake/configure_file/UnknownArg.cmake

@@ -0,0 +1,2 @@
+configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in UnknownArg.txt
+  @ONLY COPYONLY COPY_ONLY COPYFILE COPY_FILE)