[CMake] Can string(REGEX REPLACE match multiple lines?

Kent Williams nkwmailinglists at gmail.com
Fri Apr 20 12:14:02 EDT 2012


I'm trying to write a CMake patch script for a package that needs a
TARGET_LINK_LIBRARIES command replaced.

In the original it covers multiple lines, e.g.

TARGET_LINK_LIBRARIES(targetname1
boguslib1
boguslib2
boguslib3
)

I tried this to replace it:

string(REGEX REPLACE "TARGET_LINK_LIBRARIES(targetname1.*)"
  "TARGET_LINK_LIBRARIES(\${VTK_LIBRARIES} QVTK
  \${ITK_LIBRARIES} \${QT_LIBRARIES} \${QWT_LIBRARIES})"
  code "${code}")

But the regular expression doesn't appear to handle spanning lines.

Is there a good way to do this? What's the most CMake-lish way to
accomplish this?


More information about the CMake mailing list