<html><head><style data-externalstyle="true">
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
</style></head><body><div data-externalstyle="false" style="font-family:Calibri,'Segoe UI',Meiryo,'Microsoft YaHei UI','Microsoft JhengHei UI','Malgun Gothic','Khmer UI','Nirmala UI',Tunga,'Lao UI',Ebrima,sans-serif;font-size:16px;"><div>Use “^.*” at the beginning of the regex and “.*$” at the end of it.</div><div> </div><div>The ^ and $ anchor the beginning and end of the input string in CMake, not the beginning and end of a line.</div><div> </div><div> </div><div style="border-top-color: rgb(225, 225, 225); border-top-width: 1px; border-top-style: solid;">                <strong>From:</strong> Andreas Schneider<br>                <strong>Sent:</strong> March 18, 2013 1:57 PM<br>                <strong>To:</strong> cmake@cmake.org<br>                <strong>Subject:</strong> [CMake] REGEX REPLACE help<br>        </div>        <div> </div>Hi,<br><br>I'm trying to improve the FindJNI.cmake module. However I'm totally <br>incompatible with regex. I think my brain is simply not made for it.<br><br>I'm trying to get the correct path from java itself so find the header and <br>library files. However this code will simply not work at all. I'm trying since <br>hours...<br><br># openjdk<br>find_program(JAVA_EXE java)<br>if (JAVA_EXE)<br> execute_process(<br> COMMAND ${JAVA_EXE} -XshowSettings:properties<br> OUTPUT_QUIET<br> ERROR_VARIABLE __JAVA_SETTINGS<br> ERROR_STRIP_TRAILING_WHITESPACE<br> )<br><br> string(REGEX REPLACE "^ *java.home = (.+)/jre$" "\\1" _JAVA_LIBRARY_PATH <br>"${__JAVA_SETTINGS}")<br> message(STATUS "_JAVA_LIBRARY_PATH=${_JAVA_LIBRARY_PATH}")<br>endif()<br><br>This is the output of ${JAVA_EXE} -XshowSettings:properties:<br><br>Property settings:<br> awt.toolkit = sun.awt.X11.XToolkit<br> file.encoding = UTF-8<br> file.encoding.pkg = sun.io<br> file.separator = /<br> java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment<br> java.awt.printerjob = sun.print.PSPrinterJob<br> java.class.path = .<br> java.class.version = 51.0<br> java.endorsed.dirs = /usr/lib64/jvm/java-1.7.0-<br>openjdk-1.7.0/jre/lib/endorsed<br> java.ext.dirs = /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre/lib/ext<br> /usr/java/packages/lib/ext<br> java.home = /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre<br> java.io.tmpdir = /tmp<br> java.library.path = /usr/java/packages/lib/amd64<br> /usr/lib64<br> /lib64<br> /lib<br> /usr/lib<br> java.runtime.name = OpenJDK Runtime Environment<br><br><br><br>Thanks for the help.<br><br><br> -- andreas<br><br><br>-- <br>Andreas Schneider GPG-ID: F33E3FC6<br>www.cryptomilk.org asn@cryptomilk.org<br><br>--<br><br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.cmake.org/mailman/listinfo/cmake<br></div></body></html>