我使用Theos创建了一个iOS项目。它的Makefile format非常简单 - 基本上只是源文件和库/框架的列表。我需要CMake做的就是更新此文件中的源列表和库。 CMake能做到吗?
这是我目前的Makefile:
ARCHS=armv6
include $(THEOS_MAKE_PATH)/common.mk
APPLICATION_NAME = TestApp
TestApp_FILES = main.m gltest.cpp testAppDelegate.m ES1Renderer.m EAGLView.m
TestApp_FRAMEWORKS = UIKit CoreGraphics OpenGLES QuartzCore
include $(THEOS_MAKE_PATH)/application.mk
在我看来,CMake无法生成任何不是标准Unix Makefile,IDE项目等的东西。我觉得我需要编写自己的自定义CMake工具链文件来完成Theos所做的一切为了我。
如果CMake将其源列表转储到文本文件中,然后我将使用其他一些自动化工具/脚本从那里编辑它,那就没关系了。
答案 0 :(得分:0)
我能够使用 FILE(WRITE)命令让CMake生成Makefile:
file(WRITE ${MAKE_FILE}
"ARCHS=" ${ARCHS} "\n"
"APPLICATION_NAME = " ${PROJECT_NAME} "\n"
${PROJECT_NAME} "_FILES = " ${IOS_SOURCES} "\n"
${PROJECT_NAME} "_FRAMEWORKS = " ${FRAMEWORK_DEPS} "\n\n"
"include ${THEOS_PATH}/makefiles/common.mk\n"
"include ${THEOS_PATH}/makefiles/application.mk"
)
我还制作了一个空的工具链,以便CMake没有花时间为我的系统配置编译器。
set (CMAKE_SYSTEM_NAME Generic)
# Just point to anything that exists.
# We don't need CMake to generate proper build files.
set(CMAKE_C_COMPILER ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_COMPILER ${CMAKE_CURRENT_SOURCE_DIR})
# Skip the platform compiler checks
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)