[CMake] REGEX REPLACE help
David Cole
dlrdave at aol.com
Mon Mar 18 14:00:29 EDT 2013
Use “^.*” at the beginning of the regex and “.*$” at the end of it.
The ^ and $ anchor the beginning and end of the input string in CMake, not the beginning and end of a line.
From: Andreas Schneider
Sent: March 18, 2013 1:57 PM
To: cmake at cmake.org
Subject: [CMake] REGEX REPLACE help
Hi,
I'm trying to improve the FindJNI.cmake module. However I'm totally
incompatible with regex. I think my brain is simply not made for it.
I'm trying to get the correct path from java itself so find the header and
library files. However this code will simply not work at all. I'm trying since
hours...
# openjdk
find_program(JAVA_EXE java)
if (JAVA_EXE)
execute_process(
COMMAND ${JAVA_EXE} -XshowSettings:properties
OUTPUT_QUIET
ERROR_VARIABLE __JAVA_SETTINGS
ERROR_STRIP_TRAILING_WHITESPACE
)
string(REGEX REPLACE "^ *java.home = (.+)/jre$" "\\1" _JAVA_LIBRARY_PATH
"${__JAVA_SETTINGS}")
message(STATUS "_JAVA_LIBRARY_PATH=${_JAVA_LIBRARY_PATH}")
endif()
This is the output of ${JAVA_EXE} -XshowSettings:properties:
Property settings:
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.awt.printerjob = sun.print.PSPrinterJob
java.class.path = .
java.class.version = 51.0
java.endorsed.dirs = /usr/lib64/jvm/java-1.7.0-
openjdk-1.7.0/jre/lib/endorsed
java.ext.dirs = /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre/lib/ext
/usr/java/packages/lib/ext
java.home = /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/jre
java.io.tmpdir = /tmp
java.library.path = /usr/java/packages/lib/amd64
/usr/lib64
/lib64
/lib
/usr/lib
java.runtime.name = OpenJDK Runtime Environment
Thanks for the help.
-- andreas
--
Andreas Schneider GPG-ID: F33E3FC6
www.cryptomilk.org asn at cryptomilk.org
--
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130318/d6aa7af8/attachment.htm>
More information about the CMake
mailing list