[cmake-developers] [PATCH] Improve encoding handling on Windows

2016-06-30 Thread Dāvis Mosāns
On Windows getenv uses ANSI codepage so it needs to be encoded to
internally used encoding (eg. UTF-8). Here we use _wgetenv instead
and encode that.

Also typically Windows applications (eg. MSVC compiler) use current
console's codepage for output to pipes so we need to encode that
to internally used encoding (KWSYS_ENCODING_DEFAULT_CODEPAGE).

Next, when we're outputing to console need to use wide functions.

This change allows that compilers such as MSVC on Windows can be
installed in non-ASCII path and will work correctly for all
console's codepages which supports that path's characters.
---
 Source/cmBuildCommand.cxx|  4 ++--
 Source/cmCommandArgumentParserHelper.cxx |  4 ++--
 Source/cmExtraEclipseCDT4Generator.cxx   |  2 +-
 Source/cmSetCommand.cxx  |  2 +-
 Source/cmSystemTools.cxx |  5 +
 Source/cmake.cxx |  6 +++---
 Source/cmakemain.cxx | 29 ++---
 Source/kwsys/CMakeLists.txt  |  2 ++
 Source/kwsys/Directory.cxx   |  2 +-
 Source/kwsys/FStream.hxx.in  | 19 +--
 Source/kwsys/ProcessWin32.c  | 21 -
 Source/kwsys/SystemInformation.cxx   |  8 +---
 Source/kwsys/SystemTools.cxx | 28 
 13 files changed, 105 insertions(+), 27 deletions(-)

diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index fb143a2..16771cc 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -77,7 +77,7 @@ bool cmBuildCommand::MainSignature(std::vector 
const& args)
   // as the original 2-arg build_command signature:
   //
   if (!configuration || !*configuration) {
-configuration = getenv("CMAKE_CONFIG_TYPE");
+configuration = cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE");
   }
   if (!configuration || !*configuration) {
 configuration = "Release";
@@ -109,7 +109,7 @@ bool 
cmBuildCommand::TwoArgsSignature(std::vector const& args)
   const char* cacheValue = this->Makefile->GetDefinition(define);
 
   std::string configType = "Release";
-  const char* cfg = getenv("CMAKE_CONFIG_TYPE");
+  const char* cfg = cmSystemTools::GetEnv("CMAKE_CONFIG_TYPE");
   if (cfg && *cfg) {
 configType = cfg;
   }
diff --git a/Source/cmCommandArgumentParserHelper.cxx 
b/Source/cmCommandArgumentParserHelper.cxx
index 294117c..5c615c4 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -71,12 +71,12 @@ char* 
cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
 return this->EmptyVariable;
   }
   if (strcmp(key, "ENV") == 0) {
-char* ptr = getenv(var);
+const char* ptr = cmSystemTools::GetEnv(var);
 if (ptr) {
   if (this->EscapeQuotes) {
 return this->AddString(cmSystemTools::EscapeQuotes(ptr));
   } else {
-return ptr;
+return (char *)ptr;
   }
 }
 return this->EmptyVariable;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx 
b/Source/cmExtraEclipseCDT4Generator.cxx
index 16cb082..6c9e9a1 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -208,7 +208,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& 
out,
   // get the variables from the environment and from the cache and then
   // figure out which one to use:
 
-  const char* envVarValue = getenv(envVar);
+  const char* envVarValue = cmSystemTools::GetEnv(envVar);
 
   std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
   cacheEntryName += envVar;
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 1484368..c0f8ab6 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -31,7 +31,7 @@ bool cmSetCommand::InitialPass(std::vector 
const& args,
 putEnvArg += "=";
 
 // what is the current value if any
-const char* currValue = getenv(varName);
+const char* currValue = cmSystemTools::GetEnv(varName);
 delete[] varName;
 
 // will it be set to something, then set it
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2d463f3..d8a1437 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -333,7 +333,12 @@ void cmSystemTools::Message(const char* m1, const char* 
title)
  s_MessageCallbackClientData);
 return;
   } else {
+#if defined(_WIN32)
+std::wstring wm1 = cmsys::Encoding::ToWide(m1);
+std::wcerr << wm1 << std::endl << std::flush;
+#else
 std::cerr << m1 << std::endl << std::flush;
+#endif
   }
 }
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c597605..94ecd81 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -955,8 +955,8 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator* gg)
   cmSystemTools::SetForceUnixPaths(this->GlobalGenerator->GetForceUnixPaths());
 
   // Save the environment variables CXX and CC
-  const char* cxx = getenv("CXX");
-  const char* cc = 

Re: [cmake-developers] [patch] Document -H and -B

2016-06-30 Thread Dave Gittins
I don't understand the harm of documenting the options and making them
public. Brad can you explain?

I have worked with numerous colleagues who use them. So far nothing bad
happened to them!

Seems to me that they are
a) used
b) useful
c) safe

Is there context I am missing?

Dave
On 1 Jul 2016 7:31 a.m., "Ruslan Baratov via cmake-developers" <
cmake-developers@cmake.org> wrote:

> On 01-Jul-16 00:14, Shawn Waldon wrote:
>
> On Thu, Jun 30, 2016 at 5:10 PM, Ruslan Baratov 
> wrote:
>
>> On 30-Jun-16 23:57, Shawn Waldon wrote:
>>
>> On Thu, Jun 30, 2016 at 4:54 PM, Ruslan Baratovwrote:
>>
>>> On 30-Jun-16 23:40, Brad King wrote:
>>>
 On 06/30/2016 04:28 PM, Ruslan Baratov wrote:

> On 30-Jun-16 23:18, Brad King wrote:
>
>> On 06/30/2016 03:56 PM, Ruslan Baratov wrote:
>>
>>> What is the public-use way to specify source-tree and build-tree by
>>> cmake options simultaneously?
>>>
>> cd $build && cmake $src
>>
> Will not work if $build not exists.
>
 mkdir -p "$build" && cd "$build" && cmake "$src"

>>>
>>> Next issue is that this command change directory, how can I move back to
>>> the directory where I was working on?
>>
>>
>> mkdir -p "$build" && pushd "$build" && cmake "$src" && popd
>>>
>> Doesn't go back if `cmake "$src"` failed
>>
> I think Brad may have a better idea with the subshell.  But to modify this
> to work even if `cmake "$src"` failed:
>
> mkdir -p "$build" && pushd "$build" && cmake "$src"; popd
>
> > echo $?
> 0
>
> for the CMakeLists.txt with errors
>
> --
>
> 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
>
-- 

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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 01-Jul-16 00:14, Shawn Waldon wrote:
On Thu, Jun 30, 2016 at 5:10 PM, Ruslan Baratov 
> wrote:


On 30-Jun-16 23:57, Shawn Waldon wrote:

On Thu, Jun 30, 2016 at 4:54 PM, Ruslan Baratovwrote:

On 30-Jun-16 23:40, Brad King wrote:

On 06/30/2016 04:28 PM, Ruslan Baratov wrote:

On 30-Jun-16 23:18, Brad King wrote:

On 06/30/2016 03:56 PM, Ruslan Baratov wrote:

What is the public-use way to specify
source-tree and build-tree by
cmake options simultaneously?

cd $build && cmake $src

Will not work if $build not exists.

mkdir -p "$build" && cd "$build" && cmake "$src"


Next issue is that this command change directory, how can I
move back to the directory where I was working on?


mkdir -p "$build" && pushd "$build" && cmake "$src" && popd


Doesn't go back if `cmake "$src"` failed

I think Brad may have a better idea with the subshell. But to modify 
this to work even if `cmake "$src"` failed:


mkdir -p "$build" && pushd "$build" && cmake "$src"; popd

> echo $?
0

for the CMakeLists.txt with errors
-- 

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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 01-Jul-16 00:02, Brad King wrote:

On 06/30/2016 04:57 PM, Shawn Waldon wrote:

 mkdir -p "$build" && pushd "$build" && cmake "$src" && popd

Or use a ()-enclosed subshell:

  (mkdir -p "$build" && cd "$build" && cmake "$src")

-Brad

Okay, this one seems to work. Also you haven't show how `src` defined, 
e.g. I can't do 'src=.' so it should be src="`pwd`"


So instead of "cmake -H. -B_builds" we have (src="`pwd`" build=_builds 
mkdir -p "$build" && cd "$build" && cmake "$src")

And it's only for *nix.

What about Windows?

Such options definitely would be useful in CMake.

Ruslo


--

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] Document -H and -B

2016-06-30 Thread Shawn Waldon
On Thu, Jun 30, 2016 at 5:10 PM, Ruslan Baratov 
wrote:

> On 30-Jun-16 23:57, Shawn Waldon wrote:
>
> On Thu, Jun 30, 2016 at 4:54 PM, Ruslan Baratovwrote:
>
>> On 30-Jun-16 23:40, Brad King wrote:
>>
>>> On 06/30/2016 04:28 PM, Ruslan Baratov wrote:
>>>
 On 30-Jun-16 23:18, Brad King wrote:

> On 06/30/2016 03:56 PM, Ruslan Baratov wrote:
>
>> What is the public-use way to specify source-tree and build-tree by
>> cmake options simultaneously?
>>
> cd $build && cmake $src
>
 Will not work if $build not exists.

>>> mkdir -p "$build" && cd "$build" && cmake "$src"
>>>
>>
>> Next issue is that this command change directory, how can I move back to
>> the directory where I was working on?
>
>
> mkdir -p "$build" && pushd "$build" && cmake "$src" && popd
>>
> Doesn't go back if `cmake "$src"` failed
>
I think Brad may have a better idea with the subshell.  But to modify this
to work even if `cmake "$src"` failed:

mkdir -p "$build" && pushd "$build" && cmake "$src"; popd
-- 

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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 30-Jun-16 23:57, Shawn Waldon wrote:

On Thu, Jun 30, 2016 at 4:54 PM, Ruslan Baratovwrote:

On 30-Jun-16 23:40, Brad King wrote:

On 06/30/2016 04:28 PM, Ruslan Baratov wrote:

On 30-Jun-16 23:18, Brad King wrote:

On 06/30/2016 03:56 PM, Ruslan Baratov wrote:

What is the public-use way to specify source-tree
and build-tree by
cmake options simultaneously?

cd $build && cmake $src

Will not work if $build not exists.

mkdir -p "$build" && cd "$build" && cmake "$src"


Next issue is that this command change directory, how can I move
back to the directory where I was working on?


mkdir -p "$build" && pushd "$build" && cmake "$src" && popd


Doesn't go back if `cmake "$src"` failed

-- 

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] Document -H and -B

2016-06-30 Thread Brad King
On 06/30/2016 04:57 PM, Shawn Waldon wrote:
> mkdir -p "$build" && pushd "$build" && cmake "$src" && popd

Or use a ()-enclosed subshell:

 (mkdir -p "$build" && cd "$build" && cmake "$src")

-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] Document -H and -B

2016-06-30 Thread Shawn Waldon
On Thu, Jun 30, 2016 at 4:54 PM, Ruslan Baratovwrote:

> On 30-Jun-16 23:40, Brad King wrote:
>
>> On 06/30/2016 04:28 PM, Ruslan Baratov wrote:
>>
>>> On 30-Jun-16 23:18, Brad King wrote:
>>>
 On 06/30/2016 03:56 PM, Ruslan Baratov wrote:

> What is the public-use way to specify source-tree and build-tree by
> cmake options simultaneously?
>
 cd $build && cmake $src

>>> Will not work if $build not exists.
>>>
>> mkdir -p "$build" && cd "$build" && cmake "$src"
>>
>
> Next issue is that this command change directory, how can I move back to
> the directory where I was working on?


mkdir -p "$build" && pushd "$build" && cmake "$src" && popd
>
-- 

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] Document -H and -B

2016-06-30 Thread Rolf Eike Beer
Am Donnerstag, 30. Juni 2016, 23:54:42 schrieb Ruslan Baratov via cmake-
developers:
> On 30-Jun-16 23:40, Brad King wrote:
> > On 06/30/2016 04:28 PM, Ruslan Baratov wrote:
> >> On 30-Jun-16 23:18, Brad King wrote:
> >>> On 06/30/2016 03:56 PM, Ruslan Baratov wrote:
>  What is the public-use way to specify source-tree and build-tree by
>  cmake options simultaneously?
> >>> 
> >>> cd $build && cmake $src
> >> 
> >> Will not work if $build not exists.
> > 
> > mkdir -p "$build" && cd "$build" && cmake "$src"
> 
> Next issue is that this command change directory, how can I move back to
> the directory where I was working on?

pushd/popd or do the cd/cmake call in a subshell.

Eike

signature.asc
Description: This is a digitally signed message part.
-- 

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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 30-Jun-16 23:40, Brad King wrote:

On 06/30/2016 04:28 PM, Ruslan Baratov wrote:

On 30-Jun-16 23:18, Brad King wrote:

On 06/30/2016 03:56 PM, Ruslan Baratov wrote:

What is the public-use way to specify source-tree and build-tree by
cmake options simultaneously?

cd $build && cmake $src

Will not work if $build not exists.

mkdir -p "$build" && cd "$build" && cmake "$src"


Next issue is that this command change directory, how can I move back to 
the directory where I was working on?


--

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] Document -H and -B

2016-06-30 Thread Brad King
On 06/30/2016 04:28 PM, Ruslan Baratov wrote:
> On 30-Jun-16 23:18, Brad King wrote:
>> On 06/30/2016 03:56 PM, Ruslan Baratov wrote:
>>> What is the public-use way to specify source-tree and build-tree by
>>> cmake options simultaneously?
>> cd $build && cmake $src
> 
> Will not work if $build not exists.

mkdir -p "$build" && cd "$build" && cmake "$src"

-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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 30-Jun-16 23:18, Brad King wrote:

On 06/30/2016 03:56 PM, Ruslan Baratov wrote:

What is the public-use way to specify source-tree and build-tree by
cmake options simultaneously?

cd $build && cmake $src


Will not work if $build not exists.

--

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] Document -H and -B

2016-06-30 Thread Brad King
On 06/30/2016 03:56 PM, Ruslan Baratov wrote:
> What is the public-use way to specify source-tree and build-tree by 
> cmake options simultaneously?

cd $build && cmake $src

-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] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

On 30-Jun-16 22:31, Brad King wrote:

On 06/30/2016 03:23 PM, Ruslan Baratov via cmake-developers wrote:

Patch with undocumented options -H/-B.

These are undocumented because they are internal options that
are not meant for public use.
What is the public-use way to specify source-tree and build-tree by 
cmake options simultaneously?
If there is no such, what is the problem with making existing options 
public?


Ruslo
--

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] Document -H and -B

2016-06-30 Thread Brad King
On 06/30/2016 03:23 PM, Ruslan Baratov via cmake-developers wrote:
> Patch with undocumented options -H/-B.

These are undocumented because they are internal options that
are not meant for public use.

-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


[cmake-developers] [patch] Document -H and -B

2016-06-30 Thread Ruslan Baratov via cmake-developers

Hi,

Patch with undocumented options -H/-B.

Ruslo
>From 6c378bd6622ca26c43225787494d60f1a9867b22 Mon Sep 17 00:00:00 2001
From: Ruslan Baratov 
Date: Thu, 30 Jun 2016 22:17:14 +0300
Subject: [PATCH] Document -H and -B options

---
 Help/manual/OPTIONS_BUILD.txt | 20 
 Help/manual/cmake.1.rst   |  1 +
 2 files changed, 21 insertions(+)

diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index b428a74..1caa954 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -1,3 +1,23 @@
+``-H``
+ Path to directory with CMakeLists.txt.
+
+ There must be no spaces between ``-H`` and 
+ (otherwise option will be interpreted as synonym to ``--help``). Always must
+ be used with ``-B`` option. Example:
+
+ ::
+
+   cmake -H. -B_builds
+
+ Use current directory as a source tree (i.e. start with
+ ``./CMakeLists.txt``) and put generated files to the ``./_builds`` folder.
+
+``-B``
+ Path to directory where CMake will store generated files.
+
+ There must be no spaces between ``-B`` and . Always
+ must be used with ``-H`` option.
+
 ``-C ``
  Pre-load a script to populate the cache.
 
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 8f7c336..593bb2d 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -9,6 +9,7 @@ Synopsis
 .. parsed-literal::
 
  cmake [] ( | )
+ cmake -H -B []
  cmake [(-D =)...] -P 
  cmake --build  [...] [-- ...]
  cmake -E  [...]
-- 
1.9.1

-- 

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] cmake -E capabilities

2016-06-30 Thread Brad King
On 06/30/2016 09:51 AM, Tobias Hunger wrote:
> Compared to the bug report mentioned above the fields "multiconfig" and
> "recursive" are missing. I could not figure out how to get that information:-/

There is no "recursive" generator, so that does not belong in the example
anyway.  The Makefile generator does not produce recursive makefiles:

 https://cmake.org/Wiki/CMake_FAQ#Why_does_CMake_generate_recursive_Makefiles.3F

For "multiconfig", there is the cmGlobalGenerator::IsMultiConfig method.
Something similar will have to be added to the generator factory APIs
so that we can ask for this information without creating a generator.

> I could also not yet figure out a way to retrieve information on supported
> platforms and toolsets. At least I did get whether a generator supports
> toolsets, but nothing similar seems to exist for the platform part.

We don't have any information on supported platforms or toolsets.
The CMAKE_GENERATOR_PLATFORM and CMAKE_GENERATOR_TOOLSET settings
take user-specified values and we pass them through to native tools.
It is up to the user to provide valid values.

However, we can at least report whether the platform/toolset options
are supported by a given generator.  For this one could add APIs to
generator factories as mentioned above for multiconfig.

-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] cmake -E capabilities

2016-06-30 Thread Robert Maynard
It might be worthwhile to have the version section to have an explicit
dirty key instead of having to parse the string key to find that
information out.

Also wouldn't you want server-mode to be an empty dictionary, as in
the future that would contain information like the wire format
version, etc.

On Thu, Jun 30, 2016 at 9:51 AM, Tobias Hunger <tobias.hun...@qt.io> wrote:
> Hello CMake Developers!
>
> As laid out in the last mail thread about daemon-mode in CMake (for your
> reference: 
> http://public.kitware.com/pipermail/cmake-developers/2016-June/028777
> .html ), Stephen and me agreed that we needed a way for IDEs to figure out 
> which
> generators are available to cmake and more static information built into 
> CMake.
>
> There is actually a bug report about the need for this feature here:
> https://gitlab.kitware.com/cmake/cmake/issues/15462
>
> This is my attempt to solve the issue:
> https://github.com/hunger/CMake/commits/cmake-capabilities
>
> The output looks like this:
>> cmake -E capabilities --pretty-print
> {
>"generators" : [
>   {
>  "extraGenerators" : [],
>  "name" : "Watcom WMake",
>  "toolSetSupport" : false
>   },
>   {
>  "extraGenerators" : [ "CodeBlocks", "CodeLite", "Eclipse CDT4", 
> "Kate",
> "Sublime Text 2" ],
>  "name" : "Ninja",
>  "toolSetSupport" : false
>   },
>   {
>  "extraGenerators" : [
> "CodeBlocks",
> "CodeLite",
> "Eclipse CDT4",
> "KDevelop3",
> "Kate",
> "Sublime Text 2"
>  ],
>  "name" : "Unix Makefiles",
>  "toolSetSupport" : false
>   }
>],
>"server-mode" : false,
>"version" : {
>   "major" : 3,
>   "minor" : 6,
>   "patch" : 20160630,
>   "string" : "3.6.20160630-g2c759-dirty"
>}
> }
>
> This is running on my Linux machine.
>
> What do you think? What else should we report here?
>
> Compared to the bug report mentioned above the fields "multiconfig" and
> "recursive" are missing. I could not figure out how to get that information:-/
>
> I could also not yet figure out a way to retrieve information on supported
> platforms and toolsets. At least I did get whether a generator supports
> toolsets, but nothing similar seems to exist for the platform part.
>
> Does anyone have an idea how I could retrieve this information?
>
> I would also welcome some code review on the patch. The remaining items on my
> server-mode todo list are all about removing similar information from the
> server-mode commands:-)
>
> Best Regards,
> Tobias
>
> --
> Tobias Hunger, Senior Software Engineer | The Qt Company
> The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
> Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der
> Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 
> B
> --
>
> 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
-- 

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

[cmake-developers] cmake -E capabilities

2016-06-30 Thread Tobias Hunger
Hello CMake Developers!

As laid out in the last mail thread about daemon-mode in CMake (for your
reference: http://public.kitware.com/pipermail/cmake-developers/2016-June/028777
.html ), Stephen and me agreed that we needed a way for IDEs to figure out which
generators are available to cmake and more static information built into CMake.

There is actually a bug report about the need for this feature here:
https://gitlab.kitware.com/cmake/cmake/issues/15462

This is my attempt to solve the issue:
https://github.com/hunger/CMake/commits/cmake-capabilities

The output looks like this:
> cmake -E capabilities --pretty-print
{
   "generators" : [
  {
 "extraGenerators" : [],
 "name" : "Watcom WMake",
 "toolSetSupport" : false
  },
  {
 "extraGenerators" : [ "CodeBlocks", "CodeLite", "Eclipse CDT4", "Kate",
"Sublime Text 2" ],
 "name" : "Ninja",
 "toolSetSupport" : false
  },
  {
 "extraGenerators" : [
"CodeBlocks",
"CodeLite",
"Eclipse CDT4",
"KDevelop3",
"Kate",
"Sublime Text 2"
 ],
 "name" : "Unix Makefiles",
 "toolSetSupport" : false
  }
   ],
   "server-mode" : false,
   "version" : {
  "major" : 3,
  "minor" : 6,
  "patch" : 20160630,
  "string" : "3.6.20160630-g2c759-dirty"
   }
}

This is running on my Linux machine.

What do you think? What else should we report here?

Compared to the bug report mentioned above the fields "multiconfig" and
"recursive" are missing. I could not figure out how to get that information:-/

I could also not yet figure out a way to retrieve information on supported
platforms and toolsets. At least I did get whether a generator supports
toolsets, but nothing similar seems to exist for the platform part.

Does anyone have an idea how I could retrieve this information?

I would also welcome some code review on the patch. The remaining items on my
server-mode todo list are all about removing similar information from the
server-mode commands:-)

Best Regards,
Tobias

-- 
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
-- 

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] adding FindJsonCpp

2016-06-30 Thread Farbos a
Hi,

2016-06-29 19:31 GMT+02:00 Ben Boeckel :
> On Wed, Jun 29, 2016 at 17:36:45 +0200, Farbos a wrote:
>> I have a concern with generating package configs:
>>
>> 1 It seems to contain absolute path, so not really portable with git.
>
> The actual config files are generated at build time, not committed to
> the source control (template files with @variable@ spots to insert
> values are committed).

I am not sure to understand what you are saying, did they do something
wrong or could we add some stuff in order to make in work with a
source control software. Just to be sure we are talking about these
lines: 
https://github.com/open-source-parsers/jsoncpp/blob/master/CMakeLists.txt#L144

>> 2 It does not respect the naming of imported targets with `::`. As you
>> can see here: 
>> https://cmake.org/cmake/help/git-master/manual/cmake-developer.7.html#a-sample-find-module
>> The fact that it produces an appropriate diagnostic messages if that
>> target does not exist is really helpful.
>
> Not sure exactly what you mean when the config file approach "does not
> respect" imported target names, but the file that CMake generates is not
> the direct config file, but is usually included (I have CMake generate
> ${pkg}-targets.cmake). Checking for targets in the top-level script is
> certainly possible.

When I look at the generated file here jsoncppConfig.cmake, you find
these lines:
```
# Create imported target jsoncpp_lib
add_library(jsoncpp_lib SHARED IMPORTED)

set_target_properties(jsoncpp_lib PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/home/hevy/jsoncpp/0.10.5/include"
)
...
```

The thing here is the library name is jsoncpp_lib and not something
like jsoncpp::jsoncpp_lib. And like I said earlier the name "::" is a
lot more helpful.

Thanks,

-- 
Arnaud FARBOS
-- 

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