Re: [CMake] file(TO_NATIVE_PATH ... ) and cross-compiling

2018-09-27 Thread Kukosa Tomáš
Unfortunately I encountered exactly the same problem.

It would be nice to describe in documentation that file(TO_NATIVE_PATH 
...) means "native for target system" and also would be nice to 
introduce the file(TO_HOST_NATIVE_PATH ...) subcommand.

On 26.3.2018 19:40, Miroslav Keš wrote:
> I'm cross-compiling in Windows to another target system (VxWorks) but this is 
> not so important.
>
> I thought the idea behind the TO_NATIVE_PATH option was that the internal 
> CMake path representation could be transformed to the system native path so 
> that external programs that rely on the native path convention could be 
> easily used during the build.
>
> Either this my assumption is wrong or the CMake implementation is wrong. And 
> the documentation should be more detailed on the exact behavior.
>
> Mira
>
> On 03/21/2018 09:29 PM, Stephen McDowell wrote:
>> Disclaimer: I cannot speak to intent, and have never used these before.
>>
>> So since you’re cross compiling, when looking at the docs ( 
>> https://cmake.org/cmake/help/v3.0/command/file.html ), I *think* you can get 
>> away with using TO_CMAKE_PATH.  I do *not* know how you actually determine 
>> this, but the idea would be
>>
>> if (CMAKE_CROSSCOMPILING)
>>    if (… host is windows …)
>>        if (… target is unix …)
>>          … use TO_CMAKE_PATH …
>>        else()
>>          … use TO_NATIVE_PATH …
>>        endif()
>>    else() # … host is unix …
>>      if (… target is unix …)
>>        … use TO_CMAKE_PATH or TO_NATIVE_PATH …
>>      else() # … target is windows
>>        … PROBLEM …
>>      endif()
>> endif()
>>
>> That is, I think if you are compiling *on* Windows *for* Unix, you can cheat 
>> and use TO_CMAKE_PATH to get unix style paths.  But if you are compiling 
>> *on* unix *for* Windows, I don’t know how you get it to be Windows paths.
>>
>> But if this does solve Windows -> Unix, you could maybe just 
>> message(FATAL_ERROR …) saying that cross compiling for Windows from Unix is 
>> not supported.  You could also take a look at the implementation of 
>> TO_NATIVE_PATH and just snag the Windows code and make your own function 
>> that converts it, maybe calling it to_windows_path() or something?
>>
>> I hope that is helpful, but I really don’t know if anything in the above is 
>> possible :/
>>
>>
>>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] file(TO_NATIVE_PATH ... ) and cross-compiling

2018-03-26 Thread Miroslav Keš
I'm cross-compiling in Windows to another target system (VxWorks) but this is 
not so important.

I thought the idea behind the TO_NATIVE_PATH option was that the internal CMake 
path representation could be transformed to the system native path so that 
external programs that rely on the native path convention could be easily used 
during the build.

Either this my assumption is wrong or the CMake implementation is wrong. And 
the documentation should be more detailed on the exact behavior.

Mira

On 03/21/2018 09:29 PM, Stephen McDowell wrote:
> Disclaimer: I cannot speak to intent, and have never used these before.
>
> So since you’re cross compiling, when looking at the docs ( 
> https://cmake.org/cmake/help/v3.0/command/file.html ), I *think* you can get 
> away with using TO_CMAKE_PATH.  I do *not* know how you actually determine 
> this, but the idea would be
>
> if (CMAKE_CROSSCOMPILING)
>   if (… host is windows …)
>       if (… target is unix …)
>         … use TO_CMAKE_PATH …
>       else()
>         … use TO_NATIVE_PATH …
>       endif()
>   else() # … host is unix …
>     if (… target is unix …)
>       … use TO_CMAKE_PATH or TO_NATIVE_PATH …
>     else() # … target is windows
>       … PROBLEM …
>     endif()
> endif()
>
> That is, I think if you are compiling *on* Windows *for* Unix, you can cheat 
> and use TO_CMAKE_PATH to get unix style paths.  But if you are compiling *on* 
> unix *for* Windows, I don’t know how you get it to be Windows paths.
>
> But if this does solve Windows -> Unix, you could maybe just 
> message(FATAL_ERROR …) saying that cross compiling for Windows from Unix is 
> not supported.  You could also take a look at the implementation of 
> TO_NATIVE_PATH and just snag the Windows code and make your own function that 
> converts it, maybe calling it to_windows_path() or something?
>
> I hope that is helpful, but I really don’t know if anything in the above is 
> possible :/
>
>
>

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] file(TO_NATIVE_PATH ... ) and cross-compiling

2018-03-21 Thread Stephen McDowell
Disclaimer: I cannot speak to intent, and have never used these before.

So since you’re cross compiling, when looking at the docs ( 
https://cmake.org/cmake/help/v3.0/command/file.html 
 ), I think you can get 
away with using TO_CMAKE_PATH.  I do not know how you actually determine this, 
but the idea would be

if (CMAKE_CROSSCOMPILING)
  if (… host is windows …)
  if (… target is unix …)
… use TO_CMAKE_PATH …
  else()
… use TO_NATIVE_PATH …
  endif()
  else() # … host is unix …
if (… target is unix …)
  … use TO_CMAKE_PATH or TO_NATIVE_PATH …
else() # … target is windows
  … PROBLEM …
endif()
endif()

That is, I think if you are compiling on Windows for Unix, you can cheat and 
use TO_CMAKE_PATH to get unix style paths.  But if you are compiling on unix 
for Windows, I don’t know how you get it to be Windows paths.

But if this does solve Windows -> Unix, you could maybe just 
message(FATAL_ERROR …) saying that cross compiling for Windows from Unix is not 
supported.  You could also take a look at the implementation of TO_NATIVE_PATH 
and just snag the Windows code and make your own function that converts it, 
maybe calling it to_windows_path() or something?

I hope that is helpful, but I really don’t know if anything in the above is 
possible :/

-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] file(TO_NATIVE_PATH ... ) and cross-compiling

2018-03-21 Thread Miroslav Keš
Hi!

I have question concerning the file(TO_NATIVE_PATH ...) behavior.
The documentation says: "The TO_NATIVE_PATH mode converts a cmake-style  
into a native path with platform-specific slashes (\ on Windows and / 
elsewhere)."
 ... but it doesn't say if the decision is made based on the CMAKE_SYSTEM_NAME 
or the CMAKE_HOST_SYSTEM_NAME variable.

I have a project that builds the code for multiple platforms. The conversion 
works OK when building for Linux on Linux host or when building for Windows on 
a Windows host.
But if I cross-compile on a Windows for a non-Windows platform, the 
file(TO_NATIVE_PATH ...) converts paths to the target "non Windows" platform 
convention.
Is this the expected behavior?
I was going to use it when calling external programs on the build host (e.g. to 
generate Doxygen config file from a template using configure_file() ). But it 
doesn't work because of the target host path convention output.

Thanks.

Mira
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] file(TO_NATIVE_PATH ... ) and cross-compiling

2018-03-20 Thread Miroslav Keš
Hi!

I have question concerning the file(TO_NATIVE_PATH ...) behavior. The 
documentation says:

"The TO_NATIVE_PATH mode converts a cmake-style  into a native path with 
platform-specific slashes (\ on Windows and / elsewhere)."

... but it doesn't say if the decision is made based on the CMAKE_SYSTEM_NAME 
or the CMAKE_HOST_SYSTEM_NAME.

I have a project that builds the code for multiple platforms. The conversion 
works OK when building for Linux on Linux host or when building for Windows on 
a Windows host.
But if I cross-compile on a Windows for a non-Windows platform, the 
file(TO_NATIVE_PATH ...) converts paths to the target "non Windows" platform 
convention.

Is this the expected behavior?

I was going to use it when calling external programs on the build host (e.g. to 
generate Doxygen config file from a template using configure_file() ).
But it doesn't work because of the target host path convention output.

Thanks.

Mira
-- 

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:
https://cmake.org/mailman/listinfo/cmake