Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String regex replace need 6 args but..MinGW , CMake , w7

Tags:

c++

mingw

cmake

I'm trying to build in w7 an aplication that I use on CentOS 6.5 without problems, but i need to compile for Windows 32 and 64 bits. This program is using RTi libs, but Win libs are made for VS2010, I'm tryng to build with MinGW Gcc 4.x.x , CMake 2.8.12 and Maven 3.02. I corrected some data types incompatibilities but i think that may there are some problems with slash and forward slash between MinGW and Windows 7. Base program was compiled succesfully, now its time for binaries. When i execute cmake -G "MinGW Makefiles" expression, I get this errors.

CMake Error at C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:43 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.
Call Stack (most recent call first):
  C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:116 (RemoveCXXComments)
  C:/Workspace/trunk/IB/src/make/IB.DDS.cmake:12 (HasInterfaces)
  C:/Workspace/trunk/IB/src/make/IB.DDS.cmake:59 (GetDDSGeneratedFiles)
  CMakeLists.txt:6 (GenerateIDLLibrary)


 CMake Error at C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:43 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.
Call Stack (most recent call first):
  C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:65 (RemoveCXXComments)
  C:/Workspace/trunk/IB/src/make/IB.DDS.cmake:74 (FindIncludes)
  CMakeLists.txt:6 (GenerateIDLLibrary)


Includes for 'C:/MinGW/msys/1.0/home/blcoalla/trunk/Example/TestProfiles/TestPayload.idl'        are
CMake Error at C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:43 (string):
  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.
Call Stack (most recent call first):
  C:/Workspace/trunk/IB/src/make/IB.Utils.cmake:65 (RemoveCXXComments)
  C:/Workspace/trunk/IB/src/make/IB.DDS.cmake:111 (FindIncludes)
  CMakeLists.txt:6 (GenerateIDLLibrary)

Here is an extract from utils.cmake:

Macro to get the content of a file

-----------------------------------------------------------------

macro (GetFileContent OutFile)

  #message("Called GetFileContent '${ARGN}'")
  SET(cat_prog cat)
  IF(WIN32)
    IF(NOT UNIX)
      SET(cat_prog type)
    ELSE(NOT UNIX)
      message (FATAL_ERROR "cannot determine the system to call to proper 'cat/type'     method")
    ENDIF(NOT UNIX)
  ENDIF(WIN32)

  set (Out)
  set (tmp)

  foreach(gfcfile ${ARGN})

    if (NOT EXISTS ${gfcfile})
      message(FATAL_ERROR "Cannot find file '${gfcfile}'")
    endif(NOT EXISTS ${gfcfile})

    EXECUTE_PROCESS(COMMAND ${cat_prog} ${gfcfile}
                    OUTPUT_VARIABLE tmp)
    set (Out ${Out} ${tmp})

  endforeach(gfcfile ${ARGN})

  set(${OutFile} ${Out})
  #message("Leaving GetFileContent")

endmacro(GetFileContent)
#-----------------------------------------------------------------

# Macro to get includes from an IDL file
#-----------------------------------------------------------------
macro (RemoveCXXComments Output Input)

  #message("RemoveCXXComments Input: '${Input}'")
  # Remove single line comments
  string(REGEX REPLACE "(//[^\n]*\n)" "" ${Output} ${Input})
  #message("RemoveCXXComments without single line: '${${Output}}'")

  # Remove several line comments in file
  string(REGEX REPLACE "(/\\*([^*]|[\r\n]|(\\*+([^*/]|[\r\n])))*\\*+/)" "" FileContent         ${FileContent})
  #message("RemoveCXXComments without multi line: '${${Output}}'")

endmacro (RemoveCXXComments)
#-----------------------------------------------------------------






from CMakeLists.txt6:
GenerateIDLLibrary(TestPayload TestPayload.idl)

from IB.DDS.cmake:59:
# Get expected generated files
GetDDSGeneratedFiles(DDSCXXGeneratedFiles DDSHGeneratedFiles ${IdlFile})
# message("CXX Files expected to be generated:     '${DDSCXXGeneratedFiles}'")
#message("H Files expected to be generated:    '${DDSHGeneratedFiles}'")
like image 823
Borja Coalla Avatar asked Nov 29 '25 10:11

Borja Coalla


1 Answers

The error message is a hint that one of your variables is empty. You can output the variables and check which one is empty and should not be empty. I'd guess something fails for Windows and a variable is not set. If a variable is empty or not set, CMake cannot see that you gave an argument at all.

If you want to force your regex, you can make quotation marks around the arguments. Then CMake knows that you gave the right number of arguments and it does not complaint about "" as a argument. But that does not fix your real problem, but only calm your current issue. I do not advise you to do so, until you really know that it is ok.

like image 63
usr1234567 Avatar answered Dec 01 '25 07:12

usr1234567



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!