【发布时间】:2014-01-10 12:40:47
【问题描述】:
我正在尝试在 w7 中构建我在 CentOS 6.5 上使用的应用程序,但我需要针对 Windows 32 和 64 位进行编译。 该程序使用 RTi 库,但 Win 库是为 VS2010 制作的,我正在尝试使用 MinGW Gcc 4.x.x、CMake 2.8.12 和 Maven 3.02 构建。我更正了一些数据类型不兼容的问题,但我认为 MinGW 和 Windows 7 之间的斜杠和正斜杠可能存在一些问题。 基础程序编译成功,现在是二进制文件的时候了。 当我执行 cmake -G "MinGW Makefiles" 表达式时,出现此错误。
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)
这是 utils.cmake 的摘录:
Macro to get the content of a file
-----------------------------------------------------------------
宏(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}'")
【问题讨论】: