Re: [cmake-developers] [PATCH] New module FindLibDl

2014-11-25 Thread Roger Leigh
On Tue, Nov 25, 2014 at 11:41:46AM -0500, Brad King wrote:
 On 11/21/2014 02:59 PM, Chuck Atkins wrote:
  dlopen defined in dlfcn.h is part of POSIX so generally if you're
  on a *nix system then you can rely on it being there.  The associated
  library, however, is a different story, hence CMAKE_DL_LIBS.
 
 My initial reaction to Roger's post was to say that CMAKE_DL_LIBS was
 created very early in CMake and I think a module like FindLibDl would
 supersede it.  However, Chuck raises a valid point.  The dlfcn.h header
 may be in a toolchain-defined path so finding it ourselves may get
 the wrong one.  We don't have find modules for unistd.h for example.
 
 Perhaps it is simplest to update the documentation of CMAKE_DL_LIBS
 to explain this.

I don't have a problem with using CMAKE_DL_LIBS, but I am reluctant to
use it unconditionally.  While it's true that most current unix systems
support it, looking at POSIX.1-2001 it's in XSI as an optional interface
so isn't strictly guaranteed to be present.  It would be really nice to
have an an accompanying variable e.g. CMAKE_DL_FOUND which confirms that
it's safe to use, since I can't infer this from an empty CMAKE_DL_LIBS
when it's part of the standard library.

It would be equally nice to know if common-but-nonstandard extensions
such as dladdr(3) were safe to use.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linuxhttp://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-GPG Public Key  F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] New command 'file(LOCK_DIRECTORY ...)'

2014-11-25 Thread Brad King
On 11/17/2014 06:45 PM, Ruslan Baratov wrote:
 Done

Thanks.  Here are some more comments:

* Please rebase on current 'master' to resolve conflicts.

* The background.(bat|sh) files need to have quoting to work with
  spaces in the path.  Please try running tests with a source/build
  tree with spaces.

* The error messages currently use SetError(...); return false;.
  That is why you need the :  to get the prompt.  Instead you can
  use IssueMessage as shown in the hunk below for one example.
  Indented lines in the message will be printed as preformatted
  blocks so you do not have to worry about variations in the line
  wrapping of expected test output.

* Please use shorter timeouts in the test if possible to make it run
  faster.  If they become spurious/problematic then we can lengthen
  them later.

* Instead of background scripts, can you have a parent process take
  a lock, run a child with a timed out lock, and then release the
  lock?  Then the timeout can be just 0.1s in the child and there
  is no race.

Thanks,
-Brad


diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8e63892..fb64b5a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3679,10 +3679,10 @@ bool cmFileCommand::HandleLockCommand(
   if (resultVariable.empty()  !fileLockResult.IsOk())
 {
 cmOStringStream e;
-e  : error locking file \  path  \ (  result  ).;
-this-SetError(e.str());
+e  error locking file\n   path  \n(  result  ).;
+this-Makefile-IssueMessage(cmake::FATAL_ERROR, e.str());
 cmSystemTools::SetFatalErrorOccured();
-return false;
+return true;
 }

   if (!resultVariable.empty())

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] compile error in master using mingw-w64

2014-11-25 Thread Brad King
On 11/23/2014 09:02 AM, Maik Zimmermann wrote:
 I noted that the mingw build on the dashboard are not failing.

It is likely specific to the 64-bit version.  Would you be able to
run a nightly build for mingw-w64?  Instructions are here:

 http://www.cmake.org/Wiki/CMake/Git/Dashboard

 MinGW seems to define mode_t in either fcntl.h or sys/types.h

IIRC, POSIX says sys/types.h defines mode_t.  We include sys/types.h
unconditionally already in some other sources, so try adding that
to cmStandardIncludes.h.  It can go just above the

  #include stdarg.h

line.

Thanks,
-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH v5 0/4] Add continue keyword

2014-11-25 Thread Brad King
On 11/18/2014 10:34 AM, Gregor Jasny wrote:
 Changes compared to v4:
 * Use new style error reporting in cmContinueCommand.cxx
 * Reject any given arguments to continue()
 * CMP0055: Reject any arguments to break, too.
 
 I put both checks: the loop block check and the empty arguments
 check into the same policy. Please drop me a note if you want to
 have an extra policy per check.

Looks good.  I factored out the 'RunCMake.return' test into
its own commit:

 return: Add test for returning inside a foreach loop
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d124c411

Then I reordered the changes to add the break() policy first:

 Track nested loop levels in CMake language with a stack of counters
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bae604d9

 break: Add policy CMP0055 to check calls strictly
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d54617d0

I took the liberty to preserve your sign-off lines even though
they are no longer exactly what you sent.  Let me know if I
should drop them or if you still sign off the new commits.

The remaining changes are in the attached patch.  It applies
based on the above-linked commit d54617d0.  Please revise it
to add more context to the -stderr.txt files in the expected
test output.  See the hunk below as an example.  All the other
RunCMake tests that check errors like this have context too.

Thanks,
-Brad


$ git diff |cat
diff --git a/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt 
b/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
index d968a62..66be462 100644
--- a/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
+++ b/Tests/RunCMake/continue/NoArgumentsToContinue-stderr.txt
@@ -1 +1,4 @@
+CMake Error at NoArgumentsToContinue.cmake:2 \(continue\):
   The CONTINUE command does not accept any arguments.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
From 829454d13aba9f0fd92f85853a26435c715eff03 Mon Sep 17 00:00:00 2001
Message-Id: 829454d13aba9f0fd92f85853a26435c715eff03.1416944676.git.brad.k...@kitware.com
From: Gregor Jasny gja...@googlemail.com
Date: Tue, 18 Nov 2014 16:34:29 +0100
Subject: [PATCH] continue: Add a new CMake language command for loop
 continuation (#14013)

Inspired-by: Doug Barbieri
Signed-off-by: Gregor Jasny gja...@googlemail.com
---
 Help/command/break.rst |  2 +
 Help/command/continue.rst  | 12 +
 Help/manual/cmake-commands.7.rst   |  1 +
 Help/release/dev/add-continue-command.rst  |  6 +++
 Source/cmBootstrapCommands1.cxx|  2 +
 Source/cmContinueCommand.cxx   | 40 
 Source/cmContinueCommand.h | 55 ++
 Source/cmExecutionStatus.h |  7 +++
 Source/cmForEachCommand.cxx|  4 ++
 Source/cmIfCommand.cxx |  5 ++
 Source/cmWhileCommand.cxx  |  4 ++
 Tests/RunCMake/CMakeLists.txt  |  1 +
 Tests/RunCMake/continue/CMakeLists.txt |  3 ++
 .../RunCMake/continue/ContinueForEachInLists.cmake | 10 
 Tests/RunCMake/continue/ContinueForeach-stdout.txt |  4 ++
 Tests/RunCMake/continue/ContinueForeach.cmake  |  8 
 .../continue/ContinueNestedForeach-stdout.txt  |  6 +++
 .../RunCMake/continue/ContinueNestedForeach.cmake  | 13 +
 Tests/RunCMake/continue/ContinueWhile-stdout.txt   |  6 +++
 Tests/RunCMake/continue/ContinueWhile.cmake| 10 
 .../continue/NoArgumentsToContinue-result.txt  |  1 +
 .../continue/NoArgumentsToContinue-stderr.txt  |  1 +
 .../RunCMake/continue/NoArgumentsToContinue.cmake  |  3 ++
 .../RunCMake/continue/NoEnclosingBlock-result.txt  |  1 +
 .../RunCMake/continue/NoEnclosingBlock-stderr.txt  |  2 +
 Tests/RunCMake/continue/NoEnclosingBlock.cmake |  1 +
 .../continue/NoEnclosingBlockInFunction-result.txt |  1 +
 .../continue/NoEnclosingBlockInFunction-stderr.txt |  2 +
 .../continue/NoEnclosingBlockInFunction.cmake  |  8 
 Tests/RunCMake/continue/RunCMakeTest.cmake |  9 
 30 files changed, 228 insertions(+)
 create mode 100644 Help/command/continue.rst
 create mode 100644 Help/release/dev/add-continue-command.rst
 create mode 100644 Source/cmContinueCommand.cxx
 create mode 100644 Source/cmContinueCommand.h
 create mode 100644 Tests/RunCMake/continue/CMakeLists.txt
 create mode 100644 Tests/RunCMake/continue/ContinueForEachInLists.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueForeach-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueForeach.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueNestedForeach-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueNestedForeach.cmake
 create mode 100644 Tests/RunCMake/continue/ContinueWhile-stdout.txt
 create mode 100644 Tests/RunCMake/continue/ContinueWhile.cmake
 create mode 100644 

Re: [cmake-developers] Initial Attempt at Green Hill MULTI IDE Generator Support

2014-11-25 Thread Brad King
On 11/17/2014 05:16 PM, Geoffrey Viola wrote:
 I made some changes and rebased on the trunk.

Thanks.  Here are a few minor comments:

* The hunk in Modules/CMakeDetermineCompilerId.cmake is now just a
  whitespace change, so please drop it.

* Please ensure C++ sources do not have lines exceeding 79 columns.

* Please avoid trailing whitespace on source lines.

Next we need to add tests.  Since CMake won't build with this
generator we need to add tests using the generator as part of
the test suite when the needed tools are available.  Look in
Tests/CMakeLists.txt for uses of add_test_VSWinStorePhone as
an example of how this is done for another target platform.
You can either add a new test directory with dedicated code
covering capabilities of the generator, or re-use some of the
existing tests to see if they build under the new generator,
or both.

Once you get tests working, please look at submitting an
experimental build to our dashboard and posting a link to it.
You can do that from the build tree of CMake with

  ctest -C Debug -D Experimental

(or with whatever configuration you built locally).

Thanks,
-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] New command 'file(LOCK_DIRECTORY ...)'

2014-11-25 Thread Ruslan Baratov via cmake-developers

On 25-Nov-14 21:29, Brad King wrote:

* The background.(bat|sh) files need to have quoting to work with
   spaces in the path.  Please try running tests with a source/build
   tree with spaces.

* Instead of background scripts, can you have a parent process take
   a lock, run a child with a timed out lock, and then release the
   lock?

Test updated, no need to use 'background.*' scripts indeed.

* The error messages currently use SetError(...); return false;.
   That is why you need the :  to get the prompt.  Instead you can
   use IssueMessage as shown in the hunk below for one example.

's,SetError,IssueMessage,g' done
I'm not quite sure about when do I need to use 'return false'/'return 
true', so I leave 'return false' everywhere.



* Please use shorter timeouts in the test if possible to make it run
   faster.  If they become spurious/problematic then we can lengthen
   them later.

* ... Then the timeout can be just 0.1s in the child and there
   is no race.

I've set timeout to 1 sec (minimal unsigned integer).

Ruslo.
From 6b874aa940a86f9a789cfae23a8c47d609587d61 Mon Sep 17 00:00:00 2001
From: Ruslan Baratov ruslan_bara...@yahoo.com
Date: Wed, 26 Nov 2014 01:45:26 +0300
Subject: [PATCH 1/7] Add function cmSystemTools::StringToInt

---
 Source/cmSystemTools.cxx | 7 +++
 Source/cmSystemTools.h   | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index baac7b8..e247481 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2923,3 +2923,10 @@ std::vectorstd::string cmSystemTools::tokenize(const 
std::string str,
 }
   return tokens;
 }
+
+//
+bool cmSystemTools::StringToInt(const char* str, int* value) {
+  char unused;
+  const int result = sscanf(str, %d%c, value, unused);
+  return (result == 1);
+}
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 4455dd1..763389b 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -458,6 +458,9 @@ public:
   static std::vectorstd::string tokenize(const std::string str,
const std::string sep);
 
+  /** Convert string to int. Expected that the whole string is an integer */
+  static bool StringToInt(const char* str, int* value);
+
 #ifdef _WIN32
   struct WindowsFileRetry
   {
-- 
2.1.1

From 569bc681c0a980b87cd94184cfb83b44122d92a0 Mon Sep 17 00:00:00 2001
From: Ruslan Baratov ruslan_bara...@yahoo.com
Date: Wed, 26 Nov 2014 01:46:14 +0300
Subject: [PATCH 2/7] Add class cmFileLockResult

---
 Source/cmFileLockResult.cxx | 111 
 Source/cmFileLockResult.h   |  85 +
 2 files changed, 196 insertions(+)
 create mode 100644 Source/cmFileLockResult.cxx
 create mode 100644 Source/cmFileLockResult.h

diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx
new file mode 100644
index 000..045e7ee
--- /dev/null
+++ b/Source/cmFileLockResult.cxx
@@ -0,0 +1,111 @@
+/*
+  CMake - Cross Platform Makefile Generator
+  Copyright 2014 Ruslan Baratov
+
+  Distributed under the OSI-approved BSD License (the License);
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+*/
+
+#include cmFileLockResult.h
+
+#include errno.h
+
+cmFileLockResult cmFileLockResult::MakeOk()
+{
+  return cmFileLockResult(OK, 0);
+}
+
+cmFileLockResult cmFileLockResult::MakeSystem()
+{
+#if defined(_WIN32)
+  const Error lastError = GetLastError();
+#else
+  const Error lastError = errno;
+#endif
+  return cmFileLockResult(SYSTEM, lastError);
+}
+
+cmFileLockResult cmFileLockResult::MakeTimeout()
+{
+  return cmFileLockResult(TIMEOUT, 0);
+}
+
+cmFileLockResult cmFileLockResult::MakeAlreadyLocked()
+{
+  return cmFileLockResult(ALREADY_LOCKED, 0);
+}
+
+cmFileLockResult cmFileLockResult::MakeInternal()
+{
+  return cmFileLockResult(INTERNAL, 0);
+}
+
+cmFileLockResult cmFileLockResult::MakeNoFunction()
+{
+  return cmFileLockResult(NO_FUNCTION, 0);
+}
+
+bool cmFileLockResult::IsOk() const
+{
+  return this-Type == OK;
+}
+
+std::string cmFileLockResult::GetOutputMessage() const
+{
+  switch (this-Type)
+{
+case OK:
+  return 0;
+case SYSTEM:
+#if defined(_WIN32)
+  {
+  char* errorText = NULL;
+
+  // http://stackoverflow.com/a/455533/2288008
+  DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM |
+  FORMAT_MESSAGE_ALLOCATE_BUFFER |
+  FORMAT_MESSAGE_IGNORE_INSERTS;
+  ::FormatMessageA(
+  flags,
+  NULL,
+  this-ErrorValue,
+  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+