[CMake] another problem with ENV vars and windows paths
David Cole
david.cole at kitware.com
Wed Mar 22 08:34:37 EST 2006
Seems like this functionality should (perhaps) be in the STRING command...
And that the reverse transform should also be available.
Isn't it simply transforming one string into a related form...?
2 cents,
David
Alexander Neundorf wrote:
>Hi,
>
>recently cmake cvs has the new FILE() command:
>
>FILE(SYSTEM_PATH ENVIRONMENT_VARIABLE _variable)
>
>Now, there's the case that some tool outputs a list of directories (e.g.
>kde-config), which will also contain the backward slashes. For use with
>cmake the backslashes have to be replaced forward slashes. Basically this
>is what is done with FILE(SYSTEM_PATH ...)
>But this doesn't work for output from applications.
>
>We have currently the following code in FindKDE4.cmake:
>
># then ask kde-config for the kde data dirs
>EXEC_PROGRAM(${KDE4_KDECONFIG_EXECUTABLE} ARGS --path data
>OUTPUT_VARIABLE _data_DIR )
>
>IF(WIN32)
> # cmake can't handle paths with '\' correct :-(
> STRING(REGEX REPLACE "\\\\" "/" _data_DIR "${_data_DIR}")
>ELSE(WIN32)
> # replace the ":" with ";" so that it becomes a valid cmake list
> STRING(REGEX REPLACE ":" ";" _data_DIR "${_data_DIR}")
>ENDIF(WIN32)
>
>
>Maybe it would be a better idea to remove FILE(SYSTEM_PATH ...) again and
>instead add something like this:
>
>set(myPath $ENV{KDEDIRS})
>TO_CMAKE(myKdeDirs ${myPath}) ?
>
>This would work for both cases, the env. var and if the content comes
>from somewhere else.
>What do you think ?
>
>Bye
>Alex
>
>
>
>
>
More information about the CMake
mailing list