[cmake-developers] generator expression for path slash conversion

Kislinskiy, Stefan s.kislinskiy at Dkfz-Heidelberg.de
Mon Sep 21 10:21:44 EDT 2015


Ah, thank you very much! I was confused as the distinction between WIN32 and UNIX worked nevertheless.

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Montag, 21. September 2015 16:17
To: Kislinskiy, Stefan
Cc: CHEVRIER, Marc; cmake-developers at cmake.org; James Johnston
Subject: Re: [cmake-developers] generator expression for path slash conversion

On 09/21/2015 10:05 AM, Kislinskiy, Stefan wrote:
> if(MSYS)
>   check(test_shell_path "/c/shell/path")
> elseif(WIN32)
>   check(test_shell_path "c:\\\\shell\\\\path")
> elseif(UNIX)
>   check(test_shell_path "c:/shell/path")
> endif()
> 
> No matter what I'm doing, it always ends up in the WIN32 branch with 
> FORWARD slashes. Additionally the drive letter is NOT converted to a posix path as it should be the case for MSYS. I tried MSYS from the official MinGW package, and I tried the MSYS2 installer. In both cases I called cmake from MinGW-sh, MSYS-sh, and even cmd.exe. I used the "MSYS Makefiles" Generator. In addition I tried the "MinGW Makefiles" generator just to check if "if(MINGW)" is working... which also fails. The configuring/generating itself is working.. Any ideas?

The code in the check-part4.cmake script runs in a cmake script (via "cmake -P").  That does not have any information about the configuration of the project, generator used, or target platform.
If you need this information it needs to be passed in through additional "-Dvar=val" arguments prior to the -P argument.

-Brad



More information about the cmake-developers mailing list