[CMake] windows paths...
Eric NOULARD
eric.noulard at gmail.com
Mon May 12 11:47:28 EDT 2008
Le Mon, 12 May 2008 06:37:20 -0700,
"Phil Pellouchoud" <Phil at slacker.com> a écrit :
> doesn't work:
>
> S:\software\fubar\build>type ..\CMakeLists.txt
>
> FILE( TO_CMAKE_PATH GLOB "S:\software\data\profiles.xml" )
> FILE( TO_CMAKE_PATH GLOB S:\software\data\profiles.xml )
You cannot both "GLOB" and "TO_CMAKE_PATH" which are distinct
(and exclusive) command options from the FILE command.
for more detail see cmake --help-command FILE
You usually
1) Transform whatever [eventually escaped] path to CMAKE representation
SET(A_PATH "S:\\software\\data\\profiles.xml" )
FILE(TO_CMAKE_PATH ${A_PATH} A_PATH_CMAKE)
This is useful when you obtain the path from env var too:
FILE(TO_CMAKE_PATH "$ENV{MYENVAR}" MYENVAR_CMAKE)
2) Then use the xxxxx_CMAKE var for other cmake command
For example finding a program in the path obtained from env var:
FIND_PROGRAM(MY_PROG
NAMES myprog
PATHS ${MYENVAR_CMAKE})
>
> Also, I need it for commands other than file; like
> "ADD_SUBDIRECTORY()".
Use FILE first to transform any PATH into cmake representation
then use whatever CMake command you need with it
(including ADD_SUBDIRECTORY)
--
Erk
More information about the CMake
mailing list