[CMake] windowsproblem with backslashes in path variables - h ow to avoid?

Dekeyser, Kris Kris.Dekeyser at lms.be
Tue Aug 30 06:00:54 EDT 2005


Hi,

STRING(REGEX REPLACE "\\\\" "/" CORBA_ROOT_DIR ${CORBA_ROOT_DIR}) 

Works for me.

HTH, Kris

-----Original Message-----
From: Sören Freudiger [mailto:muffmolch at gmx.de] 
Sent: Tuesday, 30 August, 2005 11:49
To: cmake at cmake.org
Subject: [CMake] windowsproblem with backslashes in path variables - how to avoid?

Within windows we have this stupid problem with the backslash character
instead of slash character for seperate folders:

Enviroment variabels often are something like "C:\Programs\MPI"

If I do something like:
INCLUDE_DIRECTORIES( $ENV{MPI_DIR}/include )
Then folowing error occurs:
"Cmake Error: Invalid escape sequence \P"

Yeah that's right, because it should be "C:\\Programs\\MPI"       
Or better: "C:/Programs/MPI" 

I tried 
STRING(REGEX REPLACE "\" "/" TEST_VARIABLE "${TEST_VARIABLE}")
and
STRING(REGEX REPLACE "\\" "/" TEST_VARIABLE "${TEST_VARIABLE}")  
but all of this ends up in an error.

But if I'm doing:
SET(TEST1 $ENV{MPI_DIR})
MESSAGE(&{TEST1 }) --> C:\Programs\MPI
SET(TEST1 ${EMPTY})  --> EMPTY wasn't defined before
MESSAGE(&{TEST1 }) --> C:/Programs/MPI

So what's the standard way to avoid this problem?

Best regards,
SirAnn	 


_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
+-+-+- Email Confidentiality Footer +-+-+- 
Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not print, retain, copy nor disseminate this message or any part of it to anyone and you should notify the sender by reply email and destroy this message. Neglecting this clause could be a breach of confidence. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that are not related to the official business of my firm shall be understood as neither given nor endorsed by it.


More information about the CMake mailing list