[CMake] another problem with ENV vars and windows paths
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Mar 21 14:48:11 EST 2006
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
--
Bis zu 70% Ihrer Onlinekosten sparen: GMX SmartSurfer!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer
More information about the CMake
mailing list